mirror of
https://gitea.com/gitea/act_runner.git
synced 2026-10-28 19:06:02 +08:00
Without a docker daemon six `act/runner` tests failed instead of passing. A dry run still created and removed job networks, the job teardown dropped the dry-run flag along with every other context value, and the container mocks asked the daemon for the runner arch. This also speeds up the tests and CI without dropping assertions. Most of the time went to git and docker round trips, which are now pinned, batched or coalesced, and the dind and e2e steps cache or overlap more of their setup. On CI, `act/runner` went from 77s to 55s and `test-dind` from 108s to 55s. Locally, `act/runner` without docker went from 53s to 7s. Split out of https://gitea.com/gitea/runner/pulls/1348, which adds Windows CI on top. The go cache changes moved to https://gitea.com/gitea/runner/pulls/1350. Written by Claude Code. --------- Co-authored-by: bircni <bircni@icloud.com> Reviewed-on: https://gitea.com/gitea/runner/pulls/1349 Reviewed-by: bircni <bircni@icloud.com> Co-authored-by: silverwind <me@silverwind.io>
86 lines
1.9 KiB
Docker
86 lines
1.9 KiB
Docker
### BUILDER STAGE
|
|
#
|
|
#
|
|
FROM golang:1.27-alpine AS builder
|
|
|
|
# Do not remove `git` here, it is required for getting runner version when executing `make build`
|
|
RUN apk add --no-cache make git
|
|
|
|
ARG GOPROXY
|
|
ENV GOPROXY=${GOPROXY:-}
|
|
|
|
COPY . /opt/src/runner
|
|
WORKDIR /opt/src/runner
|
|
|
|
RUN --mount=type=cache,target=/go/pkg/mod \
|
|
--mount=type=cache,target=/root/.cache/go-build \
|
|
make clean && make build
|
|
|
|
### DIND VARIANT
|
|
#
|
|
#
|
|
FROM docker:29.9.1-dind AS dind
|
|
|
|
ARG VERSION=dev
|
|
|
|
LABEL org.opencontainers.image.source="https://gitea.com/gitea/runner"
|
|
LABEL org.opencontainers.image.version="${VERSION}"
|
|
|
|
RUN apk add --no-cache s6 bash git tzdata nftables
|
|
|
|
COPY --from=builder /opt/src/runner/gitea-runner /usr/local/bin/gitea-runner
|
|
COPY scripts/run.sh /usr/local/bin/run.sh
|
|
COPY scripts/s6 /etc/s6
|
|
|
|
VOLUME /data
|
|
|
|
ENV TINI_SUBREAPER=1
|
|
|
|
ENTRYPOINT ["s6-svscan","/etc/s6"]
|
|
|
|
### DIND-ROOTLESS VARIANT
|
|
#
|
|
#
|
|
FROM docker:29.9.1-dind-rootless AS dind-rootless
|
|
|
|
ARG VERSION=dev
|
|
|
|
LABEL org.opencontainers.image.source="https://gitea.com/gitea/runner"
|
|
LABEL org.opencontainers.image.version="${VERSION}"
|
|
|
|
USER root
|
|
RUN apk add --no-cache s6 bash git tzdata nftables
|
|
|
|
COPY --from=builder /opt/src/runner/gitea-runner /usr/local/bin/gitea-runner
|
|
COPY scripts/run.sh /usr/local/bin/run.sh
|
|
COPY scripts/s6 /etc/s6
|
|
|
|
VOLUME /data
|
|
|
|
RUN mkdir -p /data && chown -R rootless:rootless /etc/s6 /data
|
|
|
|
ENV DOCKER_HOST=unix:///run/user/1000/docker.sock
|
|
ENV TINI_SUBREAPER=1
|
|
|
|
USER rootless
|
|
ENTRYPOINT ["s6-svscan","/etc/s6"]
|
|
|
|
### BASIC VARIANT
|
|
#
|
|
#
|
|
FROM alpine:3.24 AS basic
|
|
|
|
ARG VERSION=dev
|
|
|
|
LABEL org.opencontainers.image.source="https://gitea.com/gitea/runner"
|
|
LABEL org.opencontainers.image.version="${VERSION}"
|
|
|
|
RUN apk add --no-cache tini bash git tzdata
|
|
|
|
COPY --from=builder /opt/src/runner/gitea-runner /usr/local/bin/gitea-runner
|
|
COPY scripts/run.sh /usr/local/bin/run.sh
|
|
|
|
VOLUME /data
|
|
|
|
ENTRYPOINT ["/sbin/tini","--","run.sh"]
|