Skip to content

Commit 10409c0

Browse files
Merge pull request #19 from DiamondLightSource/fix-devconatiner-venv
Create devcontainer venv with post-install.sh script
2 parents 8e56985 + 85e6e5a commit 10409c0

File tree

2 files changed

+9
-2
lines changed

2 files changed

+9
-2
lines changed

.devcontainer/devcontainer.json

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"name": "Python 3 Developer Container",
44
"build": {
55
"dockerfile": "../Dockerfile",
6-
"target": "developer"
6+
"target": "build"
77
},
88
"remoteEnv": {
99
// Allow X11 apps to run inside the container
@@ -58,5 +58,7 @@
5858
"--security-opt=label=disable"
5959
],
6060
// Mount the parent as /workspaces so we can pip install peers as editable
61-
"workspaceMount": "source=${localWorkspaceFolder}/..,target=/workspaces,type=bind"
61+
"workspaceMount": "source=${localWorkspaceFolder}/..,target=/workspaces,type=bind",
62+
// After the container is created, install the pdm env
63+
"postCreateCommand": "bash .devcontainer/post-install.sh"
6264
}

.devcontainer/post-install.sh

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
pip install --upgrade pip
2+
pdm python install
3+
pdm venv create --force
4+
pdm use -f .venv
5+
pdm install -G dev

0 commit comments

Comments
 (0)