Skip to content

Commit b4263ef

Browse files
committed
Fix builder docker image
Problem: The builder docker image was out of date and didn't copy the correct files. Solution: Copy the whole directory and run the make command to ensure everything is always in sync.
1 parent 86de560 commit b4263ef

File tree

1 file changed

+4
-9
lines changed

1 file changed

+4
-9
lines changed

build/Dockerfile

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,10 @@ ARG VERSION
44
ARG GIT_COMMIT
55
ARG DATE
66

7-
WORKDIR /go/src/github.com/nginxinc/nginx-kubernetes-gateway/cmd/gateway
7+
WORKDIR /go/src/github.com/nginxinc/nginx-kubernetes-gateway
88

9-
COPY go.mod go.sum /go/src/github.com/nginxinc/nginx-kubernetes-gateway
10-
RUN go mod download
11-
12-
COPY cmd /go/src/github.com/nginxinc/nginx-kubernetes-gateway/cmd
13-
COPY internal /go/src/github.com/nginxinc/nginx-kubernetes-gateway/internal
14-
COPY pkg /go/src/github.com/nginxinc/nginx-kubernetes-gateway/pkg
15-
RUN CGO_ENABLED=0 GOOS=linux go build -trimpath -a -ldflags "-s -w -X main.version=${VERSION} -X main.commit=${GIT_COMMIT} -X main.date=${DATE}" -o gateway .
9+
COPY . /go/src/github.com/nginxinc/nginx-kubernetes-gateway
10+
RUN make build
1611

1712
FROM alpine:3.18 as capabilizer
1813
RUN apk add --no-cache libcap
@@ -22,7 +17,7 @@ COPY ./build/out/gateway /usr/bin/
2217
RUN setcap 'cap_kill=+ep' /usr/bin/gateway
2318

2419
FROM capabilizer as container-capabilizer
25-
COPY --from=builder /go/src/github.com/nginxinc/nginx-kubernetes-gateway/cmd/gateway/gateway /usr/bin/
20+
COPY --from=builder /go/src/github.com/nginxinc/nginx-kubernetes-gateway/build/out/gateway /usr/bin/
2621
RUN setcap 'cap_kill=+ep' /usr/bin/gateway
2722

2823
FROM capabilizer as goreleaser-capabilizer

0 commit comments

Comments
 (0)