File tree Expand file tree Collapse file tree 2 files changed +10
-5
lines changed Expand file tree Collapse file tree 2 files changed +10
-5
lines changed Original file line number Diff line number Diff line change 11ARG BASE_IMAGE
22ARG BUILD_IMAGE
3+ ARG GORUNNER_VERSION=public.ecr.aws/eks-distro/kubernetes/go-runner:v0.18.0-eks-1-32-16
34ARG ARCH
45# Build the controller binary
5- FROM $BUILD_IMAGE as builder
6+ FROM $BUILD_IMAGE AS builder
67
78WORKDIR /workspace
89ENV GOPROXY direct
@@ -32,10 +33,13 @@ RUN GIT_VERSION=$(git describe --tags --always) && \
3233 CGO_ENABLED=0 GOOS=linux GO111MODULE=on go build \
3334 -ldflags="-X ${VERSION_PKG}.GitVersion=${GIT_VERSION} -X ${VERSION_PKG}.GitCommit=${GIT_COMMIT} -X ${VERSION_PKG}.BuildDate=${BUILD_DATE}" -a -o controller main.go
3435
36+
37+ FROM $GORUNNER_VERSION AS go-runner
38+
3539FROM $BASE_IMAGE
3640
3741WORKDIR /
38- COPY --from=public.ecr.aws/eks-distro/kubernetes/ go-runner:v0.18.0-eks-1-32-16 /go-runner /usr/local/bin/go-runner
42+ COPY --from=go-runner /go-runner /usr/local/bin/go-runner
3943COPY --from=builder /workspace/controller .
4044
4145ENTRYPOINT ["/controller" ]
Original file line number Diff line number Diff line change @@ -14,6 +14,7 @@ IMAGE ?= $(REPO):$(VERSION)
1414BASE_IMAGE ?= public.ecr.aws/eks-distro-build-tooling/eks-distro-minimal-base-nonroot:latest.2
1515GOLANG_VERSION ?= $(shell cat .go-version)
1616BUILD_IMAGE ?= public.ecr.aws/docker/library/golang:$(GOLANG_VERSION )
17+ GORUNNER_VERSION ?= public.ecr.aws/eks-distro/kubernetes/go-runner:v0.18.0-eks-1-32-latest
1718GOARCH ?= amd64
1819PLATFORM ?= linux/amd64
1920USER_ROLE_ARN ?= arn:aws:iam::$(AWS_ACCOUNT ) :role/VPCResourceControllerRole
@@ -77,16 +78,16 @@ delete: ## Delete controller from ~/.kube/config
7778
7879# Build the docker image with buildx
7980docker-buildx : check-env test
80- docker buildx build --platform=$(PLATFORM ) -t $(IMAGE ) -$(GOARCH ) --build-arg BASE_IMAGE=$(BASE_IMAGE ) --build-arg BUILD_IMAGE=$(BUILD_IMAGE ) --build-arg $(GOARCH ) --load .
81+ docker buildx build --platform=$(PLATFORM ) -t $(IMAGE ) -$(GOARCH ) --build-arg BASE_IMAGE=$(BASE_IMAGE ) --build-arg BUILD_IMAGE=$(BUILD_IMAGE ) --build-arg GORUNNER_VERSION= $( GORUNNER_VERSION ) --build-arg $(GOARCH ) --load .
8182
8283# Build the docker image
8384docker-build : check-env test
84- docker build --build-arg BASE_IMAGE=$(BASE_IMAGE ) --build-arg ARCH=$(GOARCH ) --build-arg BUILD_IMAGE=$(BUILD_IMAGE ) . -t ${IMAGE}
85+ docker build --build-arg BASE_IMAGE=$(BASE_IMAGE ) --build-arg ARCH=$(GOARCH ) --build-arg BUILD_IMAGE=$(BUILD_IMAGE ) --build-arg GORUNNER_VERSION= $( GORUNNER_VERSION ) . -t ${IMAGE}
8586
8687
8788# Build the docker image with buildx and no tests
8889docker-buildx-no-test :
89- docker buildx build --platform=$(PLATFORM ) -t $(IMAGE ) _$(GOARCH ) --build-arg BASE_IMAGE=$(BASE_IMAGE ) --build-arg BUILD_IMAGE=$(BUILD_IMAGE ) --build-arg $(GOARCH ) --load .
90+ docker buildx build --platform=$(PLATFORM ) -t $(IMAGE ) _$(GOARCH ) --build-arg BASE_IMAGE=$(BASE_IMAGE ) --build-arg BUILD_IMAGE=$(BUILD_IMAGE ) --build-arg GORUNNER_VERSION= $( GORUNNER_VERSION ) --build-arg $(GOARCH ) --load .
9091
9192# Push the docker image
9293docker-push : check-env
You can’t perform that action at this time.
0 commit comments