github.com/sudo-bmitch/version-bump@v0.0.0-20240503123857-70b0e3f646dd/Dockerfile.buildkit (about) 1 ARG REGISTRY=docker.io 2 ARG ALPINE_VER=3.19.1@sha256:c5b1261d6d3e43071626931fc004f70149baeba2c8ec672bd4f27761f8e1ad6b 3 ARG GO_VER=1.22.2-alpine@sha256:cdc86d9f363e8786845bea2040312b4efa321b828acdeb26f393faa864d887b0 4 5 FROM --platform=$BUILDPLATFORM ${REGISTRY}/library/golang:${GO_VER} as build 6 RUN apk add --no-cache \ 7 ca-certificates \ 8 make 9 RUN adduser -D appuser 10 WORKDIR /src 11 COPY . /src/ 12 RUN --mount=type=cache,id=gomod,target=/go/pkg/mod/cache \ 13 --mount=type=cache,id=goroot,target=/root/.cache/go-build \ 14 GOOS=${TARGETOS} GOARCH=${TARGETARCH} \ 15 make bin/version-bump 16 USER appuser 17 CMD [ "bin/version-bump" ] 18 19 FROM scratch as artifact 20 COPY --from=build /src/bin/version-bump /version-bump 21 22 FROM ${REGISTRY}/library/alpine:${ALPINE_VER} as release-alpine 23 COPY --from=build /etc/passwd /etc/group /etc/ 24 COPY --from=build /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/ 25 COPY --from=build --chown=appuser /home/appuser /home/appuser 26 COPY --from=build /src/bin/version-bump /usr/local/bin/version-bump 27 USER appuser 28 CMD [ "version-bump", "--help" ] 29 LABEL maintainer="" \ 30 org.opencontainers.image.authors="https://github.com/sudo-bmitch" \ 31 org.opencontainers.image.url="https://github.com/sudo-bmitch/version-bump" \ 32 org.opencontainers.image.documentation="https://github.com/sudo-bmitch/version-bump" \ 33 org.opencontainers.image.source="https://github.com/sudo-bmitch/version-bump" \ 34 org.opencontainers.image.version="latest" \ 35 org.opencontainers.image.vendor="" \ 36 org.opencontainers.image.licenses="Apache 2.0" \ 37 org.opencontainers.image.title="version-bump" \ 38 org.opencontainers.image.description="" 39 40 FROM scratch as release-scratch 41 COPY --from=build /etc/passwd /etc/group /etc/ 42 COPY --from=build /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/ 43 COPY --from=build --chown=appuser /home/appuser /home/appuser 44 COPY --from=build /src/bin/version-bump /version-bump 45 USER appuser 46 ENTRYPOINT [ "/version-bump" ] 47 CMD [ "--help" ] 48 LABEL maintainer="" \ 49 org.opencontainers.image.authors="https://github.com/sudo-bmitch" \ 50 org.opencontainers.image.url="https://github.com/sudo-bmitch/version-bump" \ 51 org.opencontainers.image.documentation="https://github.com/sudo-bmitch/version-bump" \ 52 org.opencontainers.image.source="https://github.com/sudo-bmitch/version-bump" \ 53 org.opencontainers.image.version="latest" \ 54 org.opencontainers.image.vendor="" \ 55 org.opencontainers.image.licenses="Apache 2.0" \ 56 org.opencontainers.image.title="version-bump" \ 57 org.opencontainers.image.description="" 58