-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
54 lines (50 loc) · 2.36 KB
/
Dockerfile
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
ARG REGISTRY=docker.io
ARG ALPINE_VER=3.20.0@sha256:77726ef6b57ddf65bb551896826ec38bc3e53f75cdde31354fbffb4f25238ebd
ARG GO_VER=1.22.4-alpine@sha256:6522f0ca555a7b14c46a2c9f50b86604a234cdc72452bf6a268cae6461d9000b
FROM ${REGISTRY}/library/golang:${GO_VER} as build
RUN apk add --no-cache \
ca-certificates \
make
RUN adduser -D appuser
WORKDIR /src
COPY . /src/
RUN 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=""