Skip to content

Commit

Permalink
Avoid unnecessary build of NGF (#1681)
Browse files Browse the repository at this point in the history
Problem:
When building an NGF image, building NGF binary will always happen,
even if it's not needed (Docker build target is not local)

Solution:
Fix it by adding a stage for a container that holds CA certs.

Introduced in 799ea76

Closes #1680
  • Loading branch information
pleshakov authored Mar 13, 2024
1 parent 6155522 commit 92c2910
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion build/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ RUN go mod download
COPY . /go/src/github.com/nginxinc/nginx-gateway-fabric
RUN make build

FROM golang:1.22 as ca-certs-provider

FROM alpine:3.19 as capabilizer
RUN apk add --no-cache libcap

Expand All @@ -28,7 +30,7 @@ RUN setcap 'cap_kill=+ep' /usr/bin/gateway
FROM scratch as common
# CA certs are needed for telemetry report and NGINX Plus usage report features, so that
# NGF can verify the server's certificate.
COPY --from=builder --link /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/
COPY --from=ca-certs-provider --link /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/
USER 102:1001
ARG BUILD_AGENT
ENV BUILD_AGENT=${BUILD_AGENT}
Expand Down

0 comments on commit 92c2910

Please sign in to comment.