-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile.buildkit
More file actions
58 lines (53 loc) · 2.55 KB
/
Dockerfile.buildkit
File metadata and controls
58 lines (53 loc) · 2.55 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
ARG REGISTRY=docker.io
ARG ALPINE_VER=3.23.3@sha256:25109184c71bdad752c8312a8623239686a9a2071e8825f20acb8f2198c3f659
ARG GO_VER=1.26.1-alpine@sha256:2389ebfa5b7f43eeafbd6be0c3700cc46690ef842ad962f6c5bd6be49ed82039
FROM --platform=$BUILDPLATFORM ${REGISTRY}/library/golang:${GO_VER} AS build
RUN apk add --no-cache \
ca-certificates \
make
RUN adduser -D appuser
WORKDIR /src
COPY . /src/
RUN --mount=type=cache,id=gomod,target=/go/pkg/mod/cache \
--mount=type=cache,id=goroot,target=/root/.cache/go-build \
GOOS=${TARGETOS} GOARCH=${TARGETARCH} \
make bin/version-bump
USER appuser
CMD [ "bin/version-bump" ]
FROM scratch AS artifact
COPY --from=build /src/bin/version-bump /version-bump
FROM ${REGISTRY}/library/alpine:${ALPINE_VER} AS release-alpine
COPY --from=build /etc/passwd /etc/group /etc/
COPY --from=build /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/
COPY --from=build --chown=appuser /home/appuser /home/appuser
COPY --from=build /src/bin/version-bump /usr/local/bin/version-bump
USER appuser
CMD [ "version-bump", "--help" ]
LABEL maintainer="" \
org.opencontainers.image.authors="https://github.com/sudo-bmitch" \
org.opencontainers.image.url="https://github.com/sudo-bmitch/version-bump" \
org.opencontainers.image.documentation="https://github.com/sudo-bmitch/version-bump" \
org.opencontainers.image.source="https://github.com/sudo-bmitch/version-bump" \
org.opencontainers.image.version="latest" \
org.opencontainers.image.vendor="" \
org.opencontainers.image.licenses="Apache 2.0" \
org.opencontainers.image.title="version-bump" \
org.opencontainers.image.description=""
FROM scratch AS release-scratch
COPY --from=build /etc/passwd /etc/group /etc/
COPY --from=build /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/
COPY --from=build --chown=appuser /home/appuser /home/appuser
COPY --from=build /src/bin/version-bump /version-bump
USER appuser
ENTRYPOINT [ "/version-bump" ]
CMD [ "--help" ]
LABEL maintainer="" \
org.opencontainers.image.authors="https://github.com/sudo-bmitch" \
org.opencontainers.image.url="https://github.com/sudo-bmitch/version-bump" \
org.opencontainers.image.documentation="https://github.com/sudo-bmitch/version-bump" \
org.opencontainers.image.source="https://github.com/sudo-bmitch/version-bump" \
org.opencontainers.image.version="latest" \
org.opencontainers.image.vendor="" \
org.opencontainers.image.licenses="Apache 2.0" \
org.opencontainers.image.title="version-bump" \
org.opencontainers.image.description=""