Skip to content

Commit 7a498a7

Browse files
Use Debian to install the correct version of Node
1 parent 0059c2e commit 7a498a7

File tree

1 file changed

+13
-13
lines changed

1 file changed

+13
-13
lines changed

frontend/Dockerfile

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,10 @@ COPY --from=build_wasm /workspace/pkg ./
8888
# Final stage - Apache with source code and build capability
8989
FROM httpd:2.4 AS final
9090

91+
# Set environment variables for Node.js version
92+
ARG NODE_VERSION
93+
ENV NODE_VERSION=${NODE_VERSION}
94+
9195
# Install system dependencies required for Node.js and build tools
9296
# hadolint ignore=DL3008
9397
RUN apt-get update && \
@@ -101,19 +105,15 @@ RUN apt-get update && \
101105

102106
WORKDIR /app
103107

104-
# Install Node.js from build argument
105-
SHELL ["/bin/bash", "-o", "pipefail", "-c"]
106-
ARG NODE_VERSION
107-
ARG TARGETARCH
108-
RUN case ${TARGETARCH} in \
109-
"amd64") \
110-
ARCH='x64' \
111-
;; \
112-
"arm64") \
113-
ARCH='arm64' \
114-
;; \
115-
esac && \
116-
curl -fsSL "https://nodejs.org/dist/v${NODE_VERSION}/node-v${NODE_VERSION}-linux-${ARCH}.tar.xz" | tar -xJ -C /usr/local --strip-components=1
108+
# Add NodeSource GPG key and repository and install Node.js
109+
RUN bash -c " \
110+
export NODE_MAJOR=$(echo ${NODE_VERSION} | cut -d. -f1); \
111+
mkdir -p /etc/apt/keyrings; \
112+
curl -fsSL https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key | gpg --dearmor -o /etc/apt/keyrings/nodesource.gpg; \
113+
echo \"deb [signed-by=/etc/apt/keyrings/nodesource.gpg] https://deb.nodesource.com/node_$${NODE_MAJOR}.x nodistro main\" | tee /etc/apt/sources.list.d/nodesource.list; \
114+
apt-get update; \
115+
apt-get install -y nodejs; \
116+
"
117117

118118
# Install Angular CLI
119119
COPY ./website/docs/developers/scripts/frontend/install-angular-cli.sh ./scripts/install-angular-cli.sh

0 commit comments

Comments
 (0)