diff --git a/src/travis2docker/templates/.devcontainer.json b/src/travis2docker/templates/.devcontainer.json new file mode 100644 index 0000000..34cb905 --- /dev/null +++ b/src/travis2docker/templates/.devcontainer.json @@ -0,0 +1,19 @@ +{ + "name": "{{ repo_project }}", + "dockerFile": "Dockerfile", + "context": ".", + "remoteUser": "root", + "workspaceFolder": "/home/odoo/instance", + "customizations": { + "vscode": { + "extensions": [ + "redhat.vscode-xml", + "ms-python.python", + "mechatroner.rainbow-csv" + ], + "settings": { + "python.analysis.extraPaths": ["/home/odoo/instance/odoo"] + } + } + } +} \ No newline at end of file diff --git a/src/travis2docker/travis2docker.py b/src/travis2docker/travis2docker.py index fd57b8f..d657a4a 100644 --- a/src/travis2docker/travis2docker.py +++ b/src/travis2docker/travis2docker.py @@ -352,11 +352,18 @@ def compute_dockerfile(self, skip_after_success=False): except TypeError: f_rvm.write(rvm_env_content) self.compute_build_scripts(count, version) + self.compute_devcontainer(self.curr_work_path) self.chmod_execution(entryp_path) work_paths.append(self.curr_work_path) self.reset() return work_paths + def compute_devcontainer(self, dest): + """Generate a .devcontainer.json file to automatically start a Development Container in Vscode""" + devcontainer = self.jinja_env.get_template(".devcontainer.json").render(self.os_kwargs) + with open(os.path.join(dest, ".devcontainer.json"), 'w') as fl: + fl.write(devcontainer) + def copy_path(self, path): """:param paths list: List of paths to copy""" src = os.path.expandvars(os.path.expanduser(path))