gitea-act-runner/Dockerfile
2024-02-11 12:20:53 +00:00

35 lines
1.4 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
RUN git clone --depth 1 --branch v0.2.6 https://gitea.com/gitea/act_runner /opt/src/act_runner
WORKDIR /opt/src/act_runner
RUN make clean && make build
FROM docker:dind
USER root
RUN apk add --no-cache \
git bash supervisor
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
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
# Add Cron to supervisord
RUN echo "" >> /etc/supervisord.conf && \
echo "[program:cron]" >> /etc/supervisord.conf && \
echo "command=/usr/sbin/crond -f" >> /etc/supervisord.conf && \
echo "stdout_logfile=/dev/fd/1" >> /etc/supervisord.conf && \
echo "stdout_logfile_maxbytes=0" >> /etc/supervisord.conf
ENTRYPOINT ["/usr/bin/supervisord", "-c", "/etc/supervisord.conf"]