-
Notifications
You must be signed in to change notification settings - Fork 9
/
Dockerfile
28 lines (23 loc) · 1.06 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
FROM --platform=$BUILDPLATFORM golang:1.16 as build
LABEL maintainer="Blake Covarrubias <[email protected]>" \
org.opencontainers.image.authors="Blake Covarrubias <[email protected]>" \
org.opencontainers.image.description="Advertises records for Kubernetes resources over multicast DNS." \
org.opencontainers.image.licenses="Apache-2.0" \
org.opencontainers.image.source="[email protected]:blake/external-mdns" \
org.opencontainers.image.title="external-mdns" \
org.opencontainers.image.url="https://github.com/blake/external-mdns"
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
COPY --from=build /release /
USER nobody
ENTRYPOINT ["/external-mdns"]