2024-10-12 08:01:23 +00:00
|
|
|
FROM --platform=$BUILDPLATFORM code.forgejo.org/oci/tonistiigi/xx AS xx
|
|
|
|
FROM --platform=$BUILDPLATFORM code.forgejo.org/oci/golang:1.21-alpine3.19 as build-env
|
|
|
|
|
2024-11-03 20:28:20 +00:00
|
|
|
LABEL maintainer="tommy@252.no"
|
|
|
|
LABEL org.opencontainers.image.title="Forgejo Runner"
|
|
|
|
LABEL org.opencontainers.image.description="Forgejo Runner for Kubernetes with minimal privileges"
|
|
|
|
LABEL org.opencontainers.image.url="https://code.252.no/tommy/containers/forgejo-runner"
|
|
|
|
LABEL org.opencontainers.image.source="https://code.252.no/tommy/containers"
|
|
|
|
LABEL org.opencontainers.image.vendor="https://code.252.no/tommy"
|
|
|
|
LABEL org.opencontainers.image.authors="tommy@252.no"
|
|
|
|
|
2024-10-12 08:01:23 +00:00
|
|
|
#
|
|
|
|
# Transparently cross compile for the target platform
|
|
|
|
#
|
|
|
|
COPY --from=xx / /
|
|
|
|
ARG TARGETPLATFORM
|
|
|
|
RUN apk --no-cache add clang lld
|
|
|
|
RUN xx-apk --no-cache add gcc musl-dev
|
|
|
|
RUN xx-go --wrap
|
|
|
|
|
|
|
|
# Do not remove `git` here, it is required for getting runner version when executing `make build`
|
|
|
|
RUN apk add --no-cache build-base git
|
|
|
|
|
|
|
|
COPY . /srv
|
|
|
|
WORKDIR /srv
|
|
|
|
|
|
|
|
RUN make clean && make build
|
|
|
|
|
|
|
|
FROM code.forgejo.org/oci/alpine:3.19
|
|
|
|
ARG RELEASE_VERSION
|
|
|
|
RUN apk add --no-cache git bash
|
|
|
|
|
|
|
|
COPY --from=build-env /srv/forgejo-runner /bin/forgejo-runner
|
|
|
|
|
|
|
|
ENV HOME=/data
|
|
|
|
|
|
|
|
USER 1000:1000
|
|
|
|
|
|
|
|
WORKDIR /data
|
|
|
|
|
|
|
|
VOLUME ["/data"]
|
|
|
|
|
|
|
|
CMD ["/bin/forgejo-runner"]
|