Skip to content

Commit 3c44e68

Browse files
committed
chore: simplify dockerfile
1 parent 72afe47 commit 3c44e68

File tree

1 file changed

+8
-12
lines changed

1 file changed

+8
-12
lines changed

scripts/docker/ubuntu24.04-xvfb.Dockerfile

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,21 @@
11
FROM ubuntu:24.04
22

3+
ARG NODE_JS_VERSION
4+
ENV NODE_JS_VERSION=${NODE_JS_VERSION}
35
ENV DEBIAN_FRONTEND=noninteractive
46
RUN apt-get update
57
RUN apt-get -y -qq install git curl apt-transport-https ca-certificates apt-utils software-properties-common
68

7-
# Install Node.js using nvm with version from VS Code's .nvmrc
8-
# This ensures we test with the same Node.js version that VS Code uses
9+
# Install Node.js using nvm (reusing pattern from .evergreen/install-node.sh)
910
ENV NVM_DIR="/root/.nvm"
1011
RUN curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.38.0/install.sh | bash && \
1112
. "$NVM_DIR/nvm.sh" && \
1213
[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion" && \
13-
NODE_VERSION=$(curl -fsSL https://raw.githubusercontent.com/microsoft/vscode/refs/heads/main/.nvmrc | tr -d '[:space:]') && \
14-
echo "Installing Node.js version from VS Code .nvmrc: $NODE_VERSION" && \
15-
nvm install --no-progress $NODE_VERSION && \
16-
nvm alias default $NODE_VERSION && \
17-
nvm use $NODE_VERSION && \
18-
echo "export NVM_DIR=\"$NVM_DIR\"" >> /root/.bashrc && \
19-
echo "export PATH=\"$NVM_DIR/versions/node/v${NODE_VERSION}/bin:\$PATH\"" >> /root/.bashrc
20-
21-
# Set PATH so node/npm are available in all contexts (using wildcard since we don't know the version at Docker ENV time)
22-
RUN bash -c ". $NVM_DIR/nvm.sh && ln -sf \$(which node) /usr/local/bin/node && ln -sf \$(which npm) /usr/local/bin/npm"
14+
nvm install --no-progress $NODE_JS_VERSION && \
15+
nvm alias default $NODE_JS_VERSION && \
16+
nvm use $NODE_JS_VERSION
17+
# Set PATH so node/npm are available in all contexts
18+
ENV PATH="$NVM_DIR/versions/node/v${NODE_JS_VERSION}/bin:$PATH"
2319

2420
# Install vscode dependencies
2521
RUN apt-get -y -qq install libnss3 gnupg libxkbfile1 libsecret-1-0 libsecret-1-dev libgtk-3-0t64 libxss1 libgbm1 libasound2t64 xvfb build-essential pkg-config

0 commit comments

Comments
 (0)