Skip to content

Commit 8203f99

Browse files
committed
[IMP] t2d: Add support for vscode with devcontainer.json
1 parent 45f4894 commit 8203f99

File tree

2 files changed

+26
-0
lines changed

2 files changed

+26
-0
lines changed
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
{
2+
"name": "{{ repo_project }}",
3+
"dockerFile": "Dockerfile",
4+
"context": ".",
5+
"remoteUser": "root",
6+
"workspaceFolder": "/home/odoo/instance",
7+
"customizations": {
8+
"vscode": {
9+
"extensions": [
10+
"redhat.vscode-xml",
11+
"ms-python.python",
12+
"mechatroner.rainbow-csv"
13+
],
14+
"settings": {
15+
"python.analysis.extraPaths": ["/home/odoo/instance/odoo"]
16+
}
17+
}
18+
}
19+
}

src/travis2docker/travis2docker.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -352,11 +352,18 @@ def compute_dockerfile(self, skip_after_success=False):
352352
except TypeError:
353353
f_rvm.write(rvm_env_content)
354354
self.compute_build_scripts(count, version)
355+
self.compute_devcontainer(self.curr_work_path)
355356
self.chmod_execution(entryp_path)
356357
work_paths.append(self.curr_work_path)
357358
self.reset()
358359
return work_paths
359360

361+
def compute_devcontainer(self, dest):
362+
"""Generate a .devcontainer.json file to automatically start a Development Container in Vscode"""
363+
devcontainer = self.jinja_env.get_template(".devcontainer.json").render(self.os_kwargs)
364+
with open(os.path.join(dest, ".devcontainer.json"), 'w') as fl:
365+
fl.write(devcontainer)
366+
360367
def copy_path(self, path):
361368
""":param paths list: List of paths to copy"""
362369
src = os.path.expandvars(os.path.expanduser(path))

0 commit comments

Comments
 (0)