-
Notifications
You must be signed in to change notification settings - Fork 19
Expand file tree
/
Copy pathDockerfile
More file actions
31 lines (24 loc) · 1.13 KB
/
Dockerfile
File metadata and controls
31 lines (24 loc) · 1.13 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
FROM --platform=$BUILDPLATFORM golang:1.16 AS build
ARG TARGETOS
ARG TARGETARCH
ARG TARGETVARIANT
ADD . /go/src/github.com/blake/external-mdns
WORKDIR /go/src/github.com/blake/external-mdns
RUN mkdir -p /release/etc &&\
echo nobody:x:65534:65534:nobody:/nonexistent:/usr/sbin/nologin > /release/etc/passwd &&\
CGO_ENABLED=0 GOOS=${TARGETOS} GOARCH=${TARGETARCH} GOARM=$(echo ${TARGETVARIANT} | cut -c2) \
go build \
-ldflags="-s -w" \
-o /release/external-mdns .
FROM scratch
LABEL maintainer="Blake Covarrubias <blake@covarrubi.as>" \
org.opencontainers.image.authors="Blake Covarrubias <blake@covarrubi.as>" \
org.opencontainers.image.description="Advertises records for Kubernetes resources over multicast DNS." \
org.opencontainers.image.licenses="Apache-2.0" \
org.opencontainers.image.source="https://github.com/blake/external-mdns" \
org.opencontainers.image.title="external-mdns" \
org.opencontainers.image.url="https://github.com/blake/external-mdns" \
org.opencontainers.image.vendor="Blake Covarrubias"
COPY --from=build /release /
USER nobody
ENTRYPOINT ["/external-mdns"]