Skip to content

Commit cac13fa

Browse files
committed
fix: Align dockefile and devcontainer node/npm versions to fix lockfile mismatch
Mismatch causes npm ci in docker build to error
1 parent ca48037 commit cac13fa

File tree

7 files changed

+3027
-1189
lines changed

7 files changed

+3027
-1189
lines changed

.devcontainer/compose.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ services:
1111
# context: .
1212
# dockerfile: .devcontainer/Dockerfile
1313

14-
image: mcr.microsoft.com/devcontainers/javascript-node:1-20-bookworm
14+
image: mcr.microsoft.com/devcontainers/javascript-node:20-bookworm
1515

1616
volumes:
1717
# Update this to wherever you want VS Code to mount the folder of your project

.devcontainer/devcontainer.json

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
"forwardPorts": [9078,3000],
2121

2222
// Use 'postCreateCommand' to run commands after the container is created.
23-
"postCreateCommand": "npm install",
23+
"postCreateCommand": ".devcontainer/postCreate.sh",
2424

2525
// Configure tool-specific properties.
2626
"customizations": {
@@ -41,8 +41,7 @@
4141
"9078": {
4242
"label": "App"
4343
}
44-
},
45-
"onCreateCommand": "export PATH=/workspaces/node_modules/.bin:/workspaces/docsite/node_modules/.bin:$PATH"
44+
}
4645

4746
// Uncomment to connect as root instead. More info: https://aka.ms/dev-containers-non-root.
4847
// "remoteUser": "root"

.devcontainer/postCreate.sh

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
#!/usr/bin/env bash
2+
3+
echo 'Adding node_modules to path'
4+
echo 'export PATH=/workspaces/node_modules/.bin:/workspaces/docsite/node_modules/.bin:$PATH' >> /home/node/.bashrc
5+
6+
echo 'Updating npm...'
7+
npm install -g npm@11.12.1
8+
9+
echo 'Installing concurrently...'
10+
npm install -g concurrently
11+
12+
echo 'If you have freshly cloned this project or node_modules folder does not exist then you should run "npm run install:parallel" now'

Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
FROM ghcr.io/linuxserver/baseimage-debian:bookworm AS base
22

33
ENV TZ=Etc/GMT
4-
ENV NODE_VERSION=20.18.1
4+
ENV NODE_VERSION=20.19.2
55

66
# borrowing openssl header removal trick from offical docker-node
77
# https://github.com/nodejs/docker-node/blob/main/18/bookworm-slim/Dockerfile#L8

docsite/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,6 @@
5858
]
5959
},
6060
"engines": {
61-
"node": ">=20.18.1"
61+
"node": ">=20.19.2"
6262
}
6363
}

0 commit comments

Comments
 (0)