Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding parameterization to go-runner Dockerfile #2709

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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)