Skip to content

Commit c07b1ea

Browse files
Download node directly from nodejs.org
1 parent 020007a commit c07b1ea

File tree

3 files changed

+22
-10
lines changed

3 files changed

+22
-10
lines changed

.github/workflows/docker.yaml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,10 @@ jobs:
8585
- name: Git checkout
8686
uses: actions/checkout@v5
8787

88+
- name: Load versions
89+
id: versions
90+
uses: ./.github/actions/load-versions
91+
8892
- name: Login to Docker Hub
8993
uses: docker/login-action@v3
9094
with:
@@ -108,6 +112,8 @@ jobs:
108112
context: ./
109113
file: ./frontend/Dockerfile
110114
platforms: ${{ matrix.arch.platform }}
115+
build-args: |
116+
NODE_VERSION=${{ steps.versions.outputs.node-version }}
111117
cache-from: type=gha
112118
cache-to: type=gha,mode=max
113119
outputs: type=image,name=${{ env.REGISTRY_FRONTEND_IMAGE }},push-by-digest=true,name-canonical=true,push=true

frontend/Dockerfile

Lines changed: 15 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -105,15 +105,21 @@ RUN apt-get update && \
105105

106106
WORKDIR /app
107107

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-
"
108+
# Fail the build if any command in a pipe fails
109+
SHELL ["/bin/bash", "-o", "pipefail", "-c"]
110+
111+
# Download and install Node.js with checksum verification
112+
RUN ARCH=$(uname -m) && \
113+
if [ "$ARCH" = "x86_64" ]; then ARCH="x64"; fi && \
114+
if [ "$ARCH" = "aarch64" ]; then ARCH="arm64"; fi && \
115+
curl -fsSL "https://nodejs.org/dist/v${NODE_VERSION}/node-v${NODE_VERSION}-linux-${ARCH}.tar.xz" -o node.tar.xz && \
116+
curl -fsSL "https://nodejs.org/dist/v${NODE_VERSION}/SHASUMS256.txt" -o SHASUMS256.txt && \
117+
grep "node-v${NODE_VERSION}-linux-${ARCH}.tar.xz" SHASUMS256.txt | awk '{print $1 " node.tar.xz"}' | sha256sum -c - && \
118+
tar -xJf node.tar.xz && \
119+
cp -r "node-v${NODE_VERSION}-linux-${ARCH}"/* /usr/local/ && \
120+
rm node.tar.xz && \
121+
rm -r "node-v${NODE_VERSION}-linux-${ARCH}" && \
122+
rm SHASUMS256.txt
117123

118124
# Add Node.js to PATH
119125
ENV PATH="/usr/local/bin:${PATH}"

frontend/docker/generate-docker-env.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,4 +75,4 @@ echo "- Message: $GIT_COMMIT_MESSAGE"
7575
echo "- Build Time: $BUILD_TIMESTAMP"
7676
echo "- Rust Channel: $RUSTC_CHANNEL"
7777
echo "- Rust Version: $RUSTC_SEMVER"
78-
echo "- Target: $CARGO_TARGET_TRIPLE"
78+
echo "- Target: $CARGO_TARGET_TRIPLE"

0 commit comments

Comments
 (0)