Skip to content
This repository has been archived by the owner on Oct 3, 2023. It is now read-only.

Commit

Permalink
Fixed multi-arch build
Browse files Browse the repository at this point in the history
  • Loading branch information
nicholasdille committed Feb 24, 2023
1 parent 8c839f1 commit b0205eb
Showing 1 changed file with 16 additions and 7 deletions.
23 changes: 16 additions & 7 deletions tools/nodejs/Dockerfile.template
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@

ARG ref=main

FROM ghcr.io/nicholasdille/docker-setup/base:${ref} AS check
FROM --platform=amd64 ghcr.io/nicholasdille/docker-setup/base:${ref} AS prepare
WORKDIR /go/src/github.com/nodejs/node
ARG name
ARG version
RUN <<EOF
Expand All @@ -18,11 +19,6 @@ else
exit 1
fi
EOF

FROM --platform=amd64 check AS prepare
WORKDIR /go/src/github.com/nodejs/node
ARG name
ARG version
RUN <<EOF
apt-get update
apt-get -y install --no-install-recommends \
Expand All @@ -47,10 +43,23 @@ make -j2
make install
EOF

FROM --platform=arm64 check AS prepare
FROM --platform=arm64 ghcr.io/nicholasdille/docker-setup/base:${ref} AS prepare
ARG name
ARG version
RUN <<EOF
MAJOR_VERSION="$(
curl --silent --location --fail https://github.com/nodejs/Release/raw/main/schedule.json \
| jq -r 'to_entries[] | select(.value.maintenance > (now | todate)) | select(.value.lts != null) | select(.value.lts < (now | todate)) | .key' \
| tr -d v
)"
if test "${version%%.*}" == "${MAJOR_VERSION}"; then
echo "### Version ${version} matches latest LTS ${MAJOR_VERSION}"
else
echo "### Version ${version} does not match latest LTS ${MAJOR_VERSION}"
exit 1
fi
EOF
RUN <<EOF
curl --silent --verbose --location --fail "https://nodejs.org/dist/v${version}/node-v${version}-linux-${alt_arch}.tar.xz" \
| tar --extract --xz --directory="${prefix}${target}" --strip-components=1 --no-same-owner \
"node-v${version}-linux-${alt_arch}/bin" \
Expand Down

0 comments on commit b0205eb

Please sign in to comment.