1
- // For format details, see https://aka.ms/devcontainer.json. For config options, see the README at:
2
- // https://github.com/microsoft/vscode-dev-containers/tree/v0.231.6/containers/python-3
1
+ // For format details, see https://containers.dev/implementors/json_reference/
3
2
{
4
- "name" : " Python 3" ,
3
+ "name" : " Python 3 Developer Container " ,
5
4
"build" : {
6
- "dockerfile" : " Dockerfile" ,
7
- "target" : " developer" ,
8
- "context" : " .." ,
9
- "args" : {}
5
+ "dockerfile" : " ../Dockerfile" ,
6
+ "target" : " build" ,
7
+ // Only upgrade pip, we will install the project below
8
+ "args" : {
9
+ "PIP_OPTIONS" : " --upgrade pip"
10
+ }
10
11
},
11
12
"remoteEnv" : {
12
13
"DISPLAY" : " ${localEnv:DISPLAY}"
13
14
},
14
- // Set *default* container specific settings.json values on container create.
15
- "settings" : {
16
- "python.defaultInterpreterPath" : " /usr/local/bin/python" ,
17
- "python.linting.enabled" : true ,
18
- "python.linting.pylintEnabled" : true ,
19
- "python.formatting.autopep8Path" : " /usr/local/py-utils/bin/autopep8" ,
20
- "python.formatting.blackPath" : " /usr/local/py-utils/bin/black" ,
21
- "python.formatting.yapfPath" : " /usr/local/py-utils/bin/yapf" ,
22
- "python.linting.banditPath" : " /usr/local/py-utils/bin/bandit" ,
23
- "python.linting.flake8Path" : " /usr/local/py-utils/bin/flake8" ,
24
- "python.linting.mypyPath" : " /usr/local/py-utils/bin/mypy" ,
25
- "python.linting.pycodestylePath" : " /usr/local/py-utils/bin/pycodestyle" ,
26
- "python.linting.pydocstylePath" : " /usr/local/py-utils/bin/pydocstyle" ,
27
- "python.linting.pylintPath" : " /usr/local/py-utils/bin/pylint"
28
- },
29
- // Add the IDs of extensions you want installed when the container is created.
30
- "extensions" : [
31
- " ms-python.python" ,
32
- " ms-python.vscode-pylance" ,
33
- " streetsidesoftware.code-spell-checker" ,
34
- " ryanluker.vscode-coverage-gutters" ,
35
- " mhutchie.git-graph" ,
36
- " eamodio.gitlens" ,
37
- " gruntfuggly.todo-tree" ,
38
- " redhat.vscode-yaml" ,
39
- " nsd.vscode-epics" ,
40
- " alefragnani.bookmarks"
41
- ],
15
+ // Add the URLs of features you want added when the container is built.
42
16
"features" : {
43
- // "docker-from-docker": "20.10",
44
- "git" : " os-provided"
17
+ "ghcr.io/devcontainers/features/common-utils:1" : {
18
+ "username" : " none" ,
19
+ "upgradePackages" : false
20
+ }
21
+ },
22
+ "customizations" : {
23
+ "vscode" : {
24
+ // Add the IDs of extensions you want installed when the container is created.
25
+ "extensions" : [
26
+ " ms-python.python" ,
27
+ " tamasfe.even-better-toml" ,
28
+ " redhat.vscode-yaml" ,
29
+ " ryanluker.vscode-coverage-gutters"
30
+ ]
31
+ }
45
32
},
46
- // Use 'forwardPorts' to make a list of ports inside the container available locally.
47
- // "forwardPorts": [],
48
- // Comment out to connect as root instead. More info: https://aka.ms/vscode-remote/containers/non-root.
49
- // "remoteUser": "vscode",
50
33
// Make sure the files we are mapping into the container exist on the host
51
- "initializeCommand" : " bash -c 'for i in $HOME/.inputrc $HOME/.bashrc_dev ; do [ -f $i ] || touch $i; done'" ,
34
+ "initializeCommand" : " bash -c 'for i in $HOME/.inputrc; do [ -f $i ] || touch $i; done'" ,
52
35
"runArgs" : [
53
- " --privileged" ,
54
36
" --net=host" ,
55
- " -v=${localEnv:HOME}/.ssh:/root/.ssh" ,
56
- " -v=${localEnv:HOME}/.bashrc_dev:/root/.bashrc" ,
57
- " -v=${localEnv:HOME}/.inputrc:/root/.inputrc"
37
+ " --security-opt=label=type:container_runtime_t"
58
38
],
59
39
"mounts" : [
60
- // map in home directory - not strictly necessary but may be useful
40
+ " source=${localEnv:HOME}/.ssh,target=/root/.ssh,type=bind" ,
41
+ " source=${localEnv:HOME}/.inputrc,target=/root/.inputrc,type=bind" ,
42
+ // map in home directory - not strictly necessary but useful
61
43
" source=${localEnv:HOME},target=${localEnv:HOME},type=bind,consistency=cached"
62
44
],
63
- "workspaceMount" : " source=${localWorkspaceFolder},target=/workspace,type=bind" ,
64
- "workspaceFolder" : " /workspace" ,
45
+ // make the workspace folder the same inside and outside of the container
46
+ "workspaceMount" : " source=${localWorkspaceFolder},target=${localWorkspaceFolder},type=bind" ,
47
+ "workspaceFolder" : " ${localWorkspaceFolder}" ,
65
48
// After the container is created, install the python project in editable form
66
- // This installs into the system python of the container
67
- "postCreateCommand" : " pip install $([ -f requirements_dev.txt ] && echo -r requirements_dev.txt ) -e .[dev]"
49
+ "postCreateCommand" : " pip install -e '.[dev]'"
68
50
}
0 commit comments