File tree Expand file tree Collapse file tree 1 file changed +20
-3
lines changed Expand file tree Collapse file tree 1 file changed +20
-3
lines changed Original file line number Diff line number Diff line change 11# Build the dnsmasq-controller binary
2- FROM golang:1.20 as builder
2+ FROM golang:1.22 as builder
33
44WORKDIR /workspace
55# Copy the Go Modules manifests
@@ -16,10 +16,27 @@ COPY controllers/ controllers/
1616COPY pkg/ pkg/
1717
1818# Build
19- RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 GO111MODULE=on go build -a -o dnsmasq-controller main.go
19+ RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 GO111MODULE=on go build -a -o dnsmasq-controller
2020
21- FROM alpine:3.17
21+
22+ # Load distroless base to get initial passwd/group files
23+ FROM gcr.io/distroless/static-debian12:latest as app
24+
25+ # Install dnsmasq
26+ FROM alpine:3.19.1 as dnsmasq
27+ # Use distroless passwd/group
28+ COPY --from=app /etc/passwd /etc/passwd
29+ COPY --from=app /etc/group /etc/group
2230RUN apk add --no-cache dnsmasq
31+
32+ # Copy dnsmasq and altered passwd/group to distroless image
33+ FROM app
34+
35+ COPY --from=dnsmasq /usr/sbin/dnsmasq /usr/sbin/dnsmasq
36+ COPY --from=dnsmasq /lib/ld-musl-x86_64.so.1 /lib/
37+ COPY --from=dnsmasq /lib/libc.musl-x86_64.so.1 /lib/
38+ COPY --from=dnsmasq /etc/passwd /etc/passwd
39+ COPY --from=dnsmasq /etc/group /etc/group
2340COPY --from=builder /workspace/dnsmasq-controller /dnsmasq-controller
2441
2542ENTRYPOINT ["/dnsmasq-controller" ]
You can’t perform that action at this time.
0 commit comments