build: install Node 24 so JS actions run in the job container
All checks were successful
build-android-builder-image / build-image (push) Successful in 2m30s

When this image is used as a Gitea Actions `container:`, the runner exec's
`node` inside it to run JS-based actions (actions/checkout, upload-artifact).
The image had no Node, so consuming app builds failed at the checkout step
with `exec: "node": executable file not found in $PATH`.

Pull Node 24 from NodeSource (Noble's apt nodejs is v18) and assert it in
the image sanity check.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
2026-06-21 17:58:54 -04:00
parent 9f177c61f9
commit 7556e9b547
2 changed files with 12 additions and 1 deletions

View File

@@ -20,6 +20,15 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
curl unzip git ca-certificates && \ curl unzip git ca-certificates && \
rm -rf /var/lib/apt/lists/* rm -rf /var/lib/apt/lists/*
# Node is required for Gitea Actions JS actions (actions/checkout,
# upload-artifact, ...) to run when this image is used as a job container —
# the runner exec's `node` inside the container. Noble's apt nodejs is v18;
# pull the current Node 24 from NodeSource instead.
ARG NODE_MAJOR=24
RUN curl -fsSL "https://deb.nodesource.com/setup_${NODE_MAJOR}.x" | bash - && \
apt-get install -y --no-install-recommends nodejs && \
rm -rf /var/lib/apt/lists/*
# Install the command-line tools into the canonical "latest" location. # Install the command-line tools into the canonical "latest" location.
RUN mkdir -p ${ANDROID_SDK_ROOT}/cmdline-tools && \ RUN mkdir -p ${ANDROID_SDK_ROOT}/cmdline-tools && \
curl -fsSL -o /tmp/tools.zip \ curl -fsSL -o /tmp/tools.zip \
@@ -42,7 +51,7 @@ RUN yes | sdkmanager --licenses >/dev/null && \
rm -rf ${ANDROID_SDK_ROOT}/.android rm -rf ${ANDROID_SDK_ROOT}/.android
# Sanity: fail the image build if the toolchain isn't actually usable. # Sanity: fail the image build if the toolchain isn't actually usable.
RUN java -version && sdkmanager --version && \ RUN java -version && sdkmanager --version && node --version && \
test -d "${ANDROID_SDK_ROOT}/platforms/${PLATFORM_VERSION}" test -d "${ANDROID_SDK_ROOT}/platforms/${PLATFORM_VERSION}"
WORKDIR /workspace WORKDIR /workspace

View File

@@ -16,6 +16,8 @@ here — and we don't need one.
- Android cmdline-tools, platform, and build-tools — **baked in**, so prod - Android cmdline-tools, platform, and build-tools — **baked in**, so prod
builds don't depend on Google's download endpoint at job time builds don't depend on Google's download endpoint at job time
- `git`, `curl`, `unzip` - `git`, `curl`, `unzip`
- Node.js 24 — so Gitea Actions JS actions (`actions/checkout`,
`upload-artifact`, …) run when this image is used as a job `container`
Pinned versions live as `ARG`s at the top of the `Dockerfile`: Pinned versions live as `ARG`s at the top of the `Dockerfile`: