Skip to content

Commit db0e132

Browse files
authored
dev: respect the IMAGE args in Makefile (#205)
Also remove stale comment & unused directive from Dockerfile. Signed-off-by: spacewander <[email protected]>
1 parent fa40dc5 commit db0e132

File tree

2 files changed

+14
-9
lines changed

2 files changed

+14
-9
lines changed

Diff for: Dockerfile

+9-5
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
1+
# Dockerfile has specific requirement to put this ARG at the beginning:
2+
# https://docs.docker.com/engine/reference/builder/#understand-how-arg-and-from-interact
3+
ARG BUILDER_IMAGE
4+
ARG BASE_IMAGE
5+
16
## Multistage build
2-
FROM golang:1.23-alpine AS build
7+
FROM ${BUILDER_IMAGE} as builder
38
ENV CGO_ENABLED=0
49
ENV GOOS=linux
510
ENV GOARCH=amd64
@@ -9,12 +14,11 @@ COPY . .
914
WORKDIR /src/pkg/ext-proc
1015
RUN go mod download
1116
RUN go build -o /ext-proc
12-
FROM alpine:latest
17+
1318
## Multistage deploy
14-
FROM gcr.io/distroless/base-debian10
15-
# Install bash
19+
FROM ${BASE_IMAGE}
1620

1721
WORKDIR /
18-
COPY --from=build /ext-proc /ext-proc
22+
COPY --from=builder /ext-proc /ext-proc
1923

2024
ENTRYPOINT ["/ext-proc"]

Diff for: Makefile

+5-4
Original file line numberDiff line numberDiff line change
@@ -31,10 +31,11 @@ IMAGE_NAME := epp
3131
IMAGE_REPO ?= $(IMAGE_REGISTRY)/$(IMAGE_NAME)
3232
IMAGE_TAG ?= $(IMAGE_REPO):$(GIT_TAG)
3333

34-
# Use distroless as minimal base image to package the manager binary
35-
# Refer to https://github.com/GoogleContainerTools/distroless for more details
36-
BASE_IMAGE ?= gcr.io/distroless/static:nonroot
37-
BUILDER_IMAGE ?= golang:$(GO_VERSION)
34+
BASE_IMAGE ?= gcr.io/distroless/base-debian10
35+
BUILDER_IMAGE ?= golang:1.23-alpine
36+
ifdef GO_VERSION
37+
BUILDER_IMAGE = golang:$(GO_VERSION)
38+
endif
3839

3940
ifdef EXTRA_TAG
4041
IMAGE_EXTRA_TAG ?= $(IMAGE_REPO):$(EXTRA_TAG)

0 commit comments

Comments
 (0)