docker-build/Dockerfile
Jonas Leder 2ecb8ddb2b
Some checks failed
build / test (push) Has been cancelled
build / build (push) Has been cancelled
build / generate-sbom (push) Has been cancelled
Port builder to Forgejo Actions
- helper reads Forgejo (GITHUB_*) variables, CI_* stay as fallback
- sequential tag pushes and one retry for Forgejo registry upload races
- trivy: native JSON reports and HIGH/CRITICAL table instead of GitLab code quality
- step outputs digest and image via GITHUB_OUTPUT
- image gets node, git and bash so actions/checkout runs inside it
- .forgejo/workflows/build.yml replaces .gitlab-ci.yml

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-11-18 00:07:56 +01:00

24 lines
No EOL
1.1 KiB
Docker

FROM --platform=$BUILDPLATFORM golang:1.27.4-alpine AS helper-tool
ENV GOPROXY=https://goproxy.jonasled.dev,direct
COPY helper/ ./
RUN CGO_ENABLED=0 go build -ldflags "-w -s" -o /build-image
FROM alpine:3.24 AS download-trivy
# renovate: datasource=github-releases depName=trivy packageName=aquasecurity/trivy
ARG TRIVY_VERSION=0.76.2
WORKDIR /app
RUN apk add --no-cache curl tar && \
curl -L https://github.com/aquasecurity/trivy/releases/download/v${TRIVY_VERSION}/trivy_${TRIVY_VERSION}_Linux-64bit.tar.gz | tar -zxvf -
FROM moby/buildkit:v0.35.0-rootless
USER root
ENV BUILDKIT_COLORS=run=green:warning=yellow:error=red:cancel=255,165,0
# nodejs + git: Forgejo Actions run node actions (actions/checkout, upload-artifact) inside the job container.
# /workspace and /var/run/act: the runner creates its work dirs there as the container user.
RUN apk add --no-cache nodejs git bash && \
mkdir /etc/buildkit /workspace /var/run/act && \
chown user:user /etc/buildkit /workspace /var/run/act
COPY --from=helper-tool /build-image /usr/local/bin/build-image
COPY --from=download-trivy /app/ /trivy
USER user
ENTRYPOINT [ "ash" ]