forked from sapcc/ntp_exporter
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile
27 lines (20 loc) · 1007 Bytes
/
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
FROM golang:1.20.2-alpine3.17 as builder
RUN apk add --no-cache --no-progress gcc git make musl-dev
COPY . /src
ARG BININFO_BUILD_DATE BININFO_COMMIT_HASH BININFO_VERSION # provided to 'make install'
RUN make -C /src install PREFIX=/pkg GO_BUILDFLAGS='-mod vendor'
################################################################################
FROM alpine:3.17
RUN addgroup -g 4200 appgroup
RUN adduser -h /home/appuser -s /sbin/nologin -G appgroup -D -u 4200 appuser
RUN apk add --no-cache --no-progress ca-certificates
COPY --from=builder /pkg/ /usr/
ARG BININFO_BUILD_DATE BININFO_COMMIT_HASH BININFO_VERSION
LABEL source_repository="https://github.com/sapcc/ntp_exporter" \
org.opencontainers.image.url="https://github.com/sapcc/ntp_exporter" \
org.opencontainers.image.created=${BININFO_BUILD_DATE} \
org.opencontainers.image.revision=${BININFO_COMMIT_HASH} \
org.opencontainers.image.version=${BININFO_VERSION}
USER 4200:4200
WORKDIR /var/empty
ENTRYPOINT [ "/usr/bin/ntp_exporter" ]