38 lines · 2.4 KB
# The cloud runner image plus a Docker engine, for jobs that use Docker actions (src/server/ci/runner-sizes.ts).
# dockerd is not started here: the job script starts it on first use with the flags Cloudflare Containers need
# (no iptables, no IP forwarding), so jobs that never reach a Docker step pay nothing for it.
FROM node:24-bookworm AS node

FROM ubuntu:24.04
ENV DEBIAN_FRONTEND=noninteractive
RUN apt-get update && apt-get install -y --no-install-recommends \
    git ca-certificates curl wget unzip zip xz-utils jq coreutils sudo gnupg lsb-release \
    software-properties-common build-essential python3 python3-pip python3-venv \
  && install -m 0755 -d /etc/apt/keyrings \
  && curl -fsSL https://download.docker.com/linux/ubuntu/gpg -o /etc/apt/keyrings/docker.asc \
  && chmod a+r /etc/apt/keyrings/docker.asc \
  && echo "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.asc] https://download.docker.com/linux/ubuntu $(. /etc/os-release && echo "$VERSION_CODENAME") stable" > /etc/apt/sources.list.d/docker.list \
  && apt-get update && apt-get install -y --no-install-recommends docker-ce docker-ce-cli containerd.io docker-buildx-plugin \
  && rm -rf /var/lib/apt/lists/*
COPY --from=node /usr/local/bin/node /usr/local/bin/node
COPY --from=node /usr/local/lib/node_modules /usr/local/lib/node_modules
RUN ln -s ../lib/node_modules/npm/bin/npm-cli.js /usr/local/bin/npm \
  && ln -s ../lib/node_modules/npm/bin/npx-cli.js /usr/local/bin/npx \
  && ln -s ../lib/node_modules/corepack/dist/corepack.js /usr/local/bin/corepack \
  && node --version && npm --version
# The latest stable Go, checksum-verified against go.dev's release list (resolved when the image is built).
RUN set -eux; \
  releases="$(curl -fsSL 'https://go.dev/dl/?mode=json')"; \
  version="$(printf '%s' "$releases" | jq -r '.[0].version')"; \
  file="$version.linux-amd64.tar.gz"; \
  sum="$(printf '%s' "$releases" | jq -r --arg f "$file" '.[0].files[] | select(.filename == $f) | .sha256')"; \
  curl -fsSL -o /tmp/go.tgz "https://go.dev/dl/$file"; \
  echo "$sum  /tmp/go.tgz" | sha256sum -c -; \
  tar -C /usr/local -xzf /tmp/go.tgz; rm /tmp/go.tgz; \
  ln -s /usr/local/go/bin/go /usr/local/bin/go; ln -s /usr/local/go/bin/gofmt /usr/local/bin/gofmt; \
  go version
ENV PATH=/root/go/bin:/usr/local/go/bin:$PATH
RUN curl -fsSL https://bun.sh/install | bash && ln -s /root/.bun/bin/bun /usr/local/bin/bun
WORKDIR /workspace
CMD ["sleep", "infinity"]