Skip to content

Commit

Permalink
Merge pull request kubernetes#2709 from jeremyrickard/custom-base-and…
Browse files Browse the repository at this point in the history
…-builder-image-for-go-runner

Adding parameterization to go-runner Dockerfile
  • Loading branch information
k8s-ci-robot committed Nov 14, 2022
2 parents 7559375 + 305bcd6 commit 61db978
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 10 deletions.
8 changes: 3 additions & 5 deletions images/build/go-runner/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,9 @@
# limitations under the License.

# Build the manager binary
ARG GO_VERSION
ARG OS_CODENAME
# TODO(codename): Consider parameterizing in Makefile based on codename
ARG DISTROLESS_IMAGE
FROM golang:${GO_VERSION}-${OS_CODENAME} as builder
ARG BUILDER_IMAGE
FROM ${BUILDER_IMAGE} as builder
WORKDIR /workspace

# Copy the sources
Expand Down Expand Up @@ -52,7 +50,7 @@ RUN go build -ldflags '-s -w -buildid= -extldflags "-static"' \
-o go-runner ${package}

# Production image
FROM gcr.io/distroless/${DISTROLESS_IMAGE}
FROM ${DISTROLESS_IMAGE}
LABEL maintainers="Kubernetes Authors"
LABEL description="go based runner for distroless scenarios"
WORKDIR /
Expand Down
11 changes: 6 additions & 5 deletions images/build/go-runner/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,13 @@ IMGNAME = go-runner
APP_VERSION = $(shell cat VERSION)
GO_MAJOR_VERSION ?= 1.19
REVISION ?= 0

# Build args
GO_VERSION ?= 1.19.3
OS_CODENAME ?= bullseye

# Build args
DISTROLESS_REGISTRY ?= gcr.io/distroless
DISTROLESS_IMAGE ?= static-debian11
BUILDER_IMAGE ?= golang:$(GO_VERSION)-$(OS_CODENAME)

# Configuration
CONFIG = go$(GO_MAJOR_VERSION)-$(OS_CODENAME)
Expand All @@ -50,6 +52,5 @@ build:
clean:
rm go-runner

BUILD_ARGS = --build-arg=GO_VERSION=$(GO_VERSION) \
--build-arg=OS_CODENAME=$(OS_CODENAME) \
--build-arg=DISTROLESS_IMAGE=$(DISTROLESS_IMAGE)
BUILD_ARGS = --build-arg=BUILDER_IMAGE=$(BUILDER_IMAGE) \
--build-arg=DISTROLESS_IMAGE=$(DISTROLESS_REGISTRY)/$(DISTROLESS_IMAGE)

0 comments on commit 61db978

Please sign in to comment.