Skip to content
Closed
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
21 changes: 16 additions & 5 deletions images/build/go-runner/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,27 @@
# See the License for the specific language governing permissions and
# limitations under the License.

# Build the manager binary
ARG DISTROLESS_IMAGE
# Build args that need to be available for FROM statements
ARG GO_VERSION
ARG BUILDER_IMAGE
ARG DISTROLESS_IMAGE

# Get Go from official Alpine image
FROM golang:${GO_VERSION}-alpine as go-source

# Build the manager binary
FROM ${BUILDER_IMAGE} as builder
WORKDIR /workspace

# Copy Go installation from official image
COPY --from=go-source /usr/local/go /usr/local/go

# Set up Go environment
ENV PATH=/usr/local/go/bin:$PATH
ENV GOROOT=/usr/local/go

# Copy the sources
WORKDIR /workspace
COPY ./go-runner.go ./
COPY ./go.* ./

Expand All @@ -38,11 +52,8 @@ ENV GOPROXY="https://proxy.golang.org|direct"

# Build
ARG package=.
ARG ARCH

ENV CGO_ENABLED=0
ENV GOOS=linux
ENV GOARCH=${ARCH}

RUN go env

Expand Down
7 changes: 4 additions & 3 deletions images/build/go-runner/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,12 @@ APP_VERSION = $(shell cat VERSION)
GO_MAJOR_VERSION ?= 1.24
REVISION ?= 0
GO_VERSION ?= 1.24.6
OS_CODENAME ?= bookworm
OS_CODENAME ?= bookworm-slim

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

# Configuration
CONFIG = go$(GO_MAJOR_VERSION)-$(OS_CODENAME)
Expand Down Expand Up @@ -53,4 +53,5 @@ clean:
rm go-runner

BUILD_ARGS = --build-arg=BUILDER_IMAGE=$(BUILDER_IMAGE) \
--build-arg=DISTROLESS_IMAGE=$(DISTROLESS_REGISTRY)/$(DISTROLESS_IMAGE)
--build-arg=DISTROLESS_IMAGE=$(DISTROLESS_REGISTRY)/$(DISTROLESS_IMAGE) \
--build-arg=GO_VERSION=$(GO_VERSION)
4 changes: 2 additions & 2 deletions images/build/go-runner/cloudbuild.yaml
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
# See https://github.com/kubernetes/test-infra/blob/master/config/jobs/image-pushing/README.md for more details on image pushing process

# this must be specified in seconds. If omitted, defaults to 600s (10 mins)
timeout: 3600s
timeout: 28800s

# this prevents errors if you don't use both _GIT_TAG and _PULL_BASE_REF,
# or any new substitutions added in the future.
options:
substitutionOption: ALLOW_LOOSE
machineType: 'N1_HIGHCPU_8'
machineType: E2_HIGHCPU_32

steps:
- name: 'ghcr.io/sigstore/cosign/cosign:v2.5.3-dev@sha256:fe84ab87222b60d2d87f5efcb8ef3cfd895897c088fbeb973280689c81aedff1'
Expand Down