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 1
1
# Build the dnsmasq-controller binary
2
- FROM golang:1.20 as builder
2
+ FROM golang:1.22 as builder
3
3
4
4
WORKDIR /workspace
5
5
# Copy the Go Modules manifests
@@ -16,10 +16,27 @@ COPY controllers/ controllers/
16
16
COPY pkg/ pkg/
17
17
18
18
# 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
20
20
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
22
30
RUN 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
23
40
COPY --from=builder /workspace/dnsmasq-controller /dnsmasq-controller
24
41
25
42
ENTRYPOINT ["/dnsmasq-controller" ]
You can’t perform that action at this time.
0 commit comments