Skip to content

Commit

Permalink
[IMP] t2d: Add support for vscode with devcontainer.json
Browse files Browse the repository at this point in the history
  • Loading branch information
crazybolillo committed Oct 6, 2022
1 parent 45f4894 commit 67af4cf
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 0 deletions.
19 changes: 19 additions & 0 deletions src/travis2docker/templates/.devcontainer.json
Original file line number Diff line number Diff line change
@@ -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"]
}
}
}
}
7 changes: 7 additions & 0 deletions src/travis2docker/travis2docker.py
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand Down

0 comments on commit 67af4cf

Please sign in to comment.