Skip to content

Commit e395036

Browse files
committed
Update dev container so it uses the same users as the host. This prevents permissions issues when swapping between the 2
1 parent 8e4f364 commit e395036

File tree

3 files changed

+7
-2
lines changed

3 files changed

+7
-2
lines changed

.devcontainer/devcontainer.json

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,14 @@
55
"dockerComposeFile": "docker-compose.yaml",
66
"service": "app",
77
"workspaceFolder": "/workspace",
8+
"containerUser": "node",
9+
"remoteUser": "node",
10+
"updateRemoteUserUID": true,
811
"shutdownAction": "stopCompose",
912
// Expose the application + the mailcatcher for checking emails.
1013
"forwardPorts": [8080, 1080],
1114
// Wipes the database on every start.
12-
"postStartCommand": "rm -rf /db && mkdir -p /db",
15+
"postStartCommand": "mkdir -p /workspace/.devcontainer/db && rm -rf /workspace/.devcontainer/db/*",
1316
"customizations": {
1417
"vscode": {
1518
"extensions": [

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,4 @@
33
/.cache/
44
*.ignore
55
.env
6+
.devcontainer/db/

Dockerfile

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,8 @@ RUN npx tsc
4343

4444
FROM bun AS dev_container
4545
RUN apt-get update \
46-
&& apt-get install -y git make
46+
&& apt-get install -y git make \
47+
&& ln -s /workspace/.devcontainer/db /db
4748

4849
FROM node AS prod
4950
COPY --from=prod-deps /app/node_modules node_modules/

0 commit comments

Comments
 (0)