gitea-act-runner/Dockerfile

39 lines
1.3 KiB
Docker

FROM golang:1.21-alpine3.18 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 ACT_VERSION=0.2.10
RUN git clone --depth 1 --branch v${ACT_VERSION} https://gitea.com/gitea/act_runner /opt/src/act_runner
WORKDIR /opt/src/act_runner
RUN make clean && make build
FROM docker:25.0.5-dind
USER root
RUN apk add --no-cache \
git bash supervisor python3 py3-pip
RUN pip3 install --break-system-packages supervisord-dependent-startup
COPY --from=builder /opt/src/act_runner/act_runner /usr/local/bin/act_runner
COPY --from=builder /opt/src/act_runner/scripts/supervisord.conf /etc/supervisord.conf
COPY --from=builder /opt/src/act_runner/scripts/run.sh /opt/act/run.sh
COPY --from=builder /opt/src/act_runner/scripts/rootless.sh /opt/act/rootless.sh
COPY /root /
RUN chmod +x /healthcheck.sh
ENV DOCKER_PRUNE_INTERVAL="0 0 * * *"
# Add Crontab for root user
RUN echo "${DOCKER_PRUNE_INTERVAL} echo Pruning docker volumes && docker volume prune -af" > .crontab.txt && crontab .crontab.txt
# Remove warning from supervisord about running as root
RUN sed -i '/\[supervisord\]/a user=root' /etc/supervisord.conf
HEALTHCHECK --interval=30s --timeout=15s --start-period=30s --retries=3 CMD "/healthcheck.sh"
ENTRYPOINT ["/usr/bin/supervisord", "-c", "/etc/supervisord.conf"]