File tree Expand file tree Collapse file tree 3 files changed +23
-5
lines changed Expand file tree Collapse file tree 3 files changed +23
-5
lines changed Original file line number Diff line number Diff line change 16
16
17
17
# GoLand IDE
18
18
.idea
19
+
20
+ # Binary
21
+ gateway
Original file line number Diff line number Diff line change @@ -5,11 +5,21 @@ PREFIX = nginx-gateway
5
5
GIT_COMMIT = $(shell git rev-parse HEAD)
6
6
DATE = $(shell date -u +"% Y-% m-% dT% H:% M:% SZ")
7
7
8
+ TARGET ?= local
9
+
8
10
KIND_KUBE_CONFIG_FOLDER = $${HOME}/.kube/kind
9
11
12
+ export DOCKER_BUILDKIT = 1
13
+
10
14
.PHONY : container
11
- container :
12
- docker build --build-arg VERSION=$(VERSION ) --build-arg GIT_COMMIT=$(GIT_COMMIT ) --build-arg DATE=$(DATE ) --target container -f build/Dockerfile -t $(PREFIX ) :$(TAG ) .
15
+ container : build
16
+ docker build --build-arg VERSION=$(VERSION ) --build-arg GIT_COMMIT=$(GIT_COMMIT ) --build-arg DATE=$(DATE ) --target $(TARGET ) -f build/Dockerfile -t $(PREFIX ) :$(TAG ) .
17
+
18
+ .PHONY : build
19
+ build :
20
+ ifeq (${TARGET},local)
21
+ 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 github.com/nginxinc/nginx-gateway-kubernetes/cmd/gateway
22
+ endif
13
23
14
24
.PHONY : deps
15
25
deps :
Original file line number Diff line number Diff line change @@ -11,7 +11,12 @@ RUN go mod download
11
11
COPY cmd /go/src/github.com/nginxinc/nginx-gateway-kubernetes/cmd
12
12
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 .
13
13
14
- FROM scratch as container
15
- COPY --from=builder /go/src/github.com/nginxinc/nginx-gateway-kubernetes/cmd/gateway/gateway /usr/bin/
14
+ FROM scratch as common
16
15
USER 1001:1001
17
- ENTRYPOINT [ "/usr/bin/gateway" ]
16
+ ENTRYPOINT [ "/usr/bin/gateway" ]
17
+
18
+ FROM common as container
19
+ COPY --from=builder /go/src/github.com/nginxinc/nginx-gateway-kubernetes/cmd/gateway/gateway /usr/bin/
20
+
21
+ FROM common as local
22
+ COPY ./gateway /usr/bin/
You can’t perform that action at this time.
0 commit comments