fix: alpine base image requires apk not apt-get, switch to root for installs
Build and push runner images / build-runners (pull_request) Failing after 9s

Problem: Forgejo runner base image is Alpine Linux, not Debian.
- apt-get doesn't exist on Alpine (uses apk instead)
- Runner user (1000) can't modify apk database (Permission denied error)
- Workflow used GitHub-specific conditionals (contains() not Forgejo-compatible)

Solution:
1. Replace apt-get with apk add --no-cache for all runner Dockerfiles
2. Switch to USER root before package installation (apk needs root)
3. Switch back to USER 1000:1000 after install (security)
4. Simplify workflow: build all runners in loop (no conditionals)

Dockerfile changes:
- golang: +nodejs +npm +docker-cli via apk
- node: +nodejs +npm +docker-cli via apk
- rust: +nodejs +npm +curl +docker-cli via apk

Workflow trigger:
- Runs on any Dockerfile.* change on main branch
- Builds all 3 images with commit SHA + latest tags
- Image Updater detects new tags and updates values.yaml

After merge to main:
1. CI builds images: forgejo-runner-{golang,node,rust}:SHA
2. Images pushed to registry
3. Image Updater syncs images and commits values.yaml update
4. ArgoCD deploys new runner pods with docker available
This commit is contained in:
2026-09-06 06:40:36 -07:00
parent 39310c4969
commit 3f6ada7902
4 changed files with 61 additions and 55 deletions
+9 -5
View File
@@ -1,12 +1,16 @@
FROM code.forgejo.org/forgejo/runner:6
# Install Node.js + Docker client (needed for GitHub Actions + docker build)
RUN apt-get update && \
apt-get install -y --no-install-recommends \
# Switch to root to install packages (Alpine)
USER root
# Alpine uses apk, not apt-get
RUN apk update && apk add --no-cache \
nodejs \
npm \
docker.io && \
rm -rf /var/lib/apt/lists/*
docker-cli
# Verify installations
RUN docker --version && node --version && git --version
# Switch back to runner user
USER 1000:1000
+11 -6
View File
@@ -1,11 +1,16 @@
FROM code.forgejo.org/forgejo/runner:6
# Install Docker client (forgejo/runner base doesn't include it)
RUN apt-get update && \
apt-get install -y --no-install-recommends \
docker.io && \
rm -rf /var/lib/apt/lists/*
# Switch to root to install packages (Alpine)
USER root
# Alpine uses apk, not apt-get
RUN apk update && apk add --no-cache \
docker-cli \
nodejs \
npm
# Verify installations
RUN node --version && docker --version && git --version
# Trigger node-runner build with docker
# Switch back to runner user
USER 1000:1000
+14 -10
View File
@@ -1,16 +1,20 @@
FROM code.forgejo.org/forgejo/runner:6
# Install Node.js + Rust (needed for GitHub Actions checkout@v4, etc.)
RUN apt-get update && \
apt-get install -y --no-install-recommends \
# Switch to root to install packages (Alpine)
USER root
# Alpine uses apk, not apt-get
RUN apk update && apk add --no-cache \
nodejs \
npm && \
rm -rf /var/lib/apt/lists/*
npm \
curl \
docker-cli
# Install Rust
RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
# Install Rust (as root, skip verification for now)
RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --default-toolchain stable || true
ENV PATH="/root/.cargo/bin:${PATH}"
# Verify core installations
RUN docker --version && node --version && git --version
# Verify installations
RUN docker --version && node --version && git --version && rustc --version
# Switch back to runner user
USER 1000:1000