Skip to content
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
6 changes: 4 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
# Base image to use at runtime
ARG base_image=public.ecr.aws/eks-distro-build-tooling/eks-distro-minimal-base-nonroot:2024-04-01-1711929684.2
ARG base_image=public.ecr.aws/eks-distro-build-tooling/eks-distro-minimal-base-nonroot

# Golang image to use for compiling the manager
ARG builder_image=public.ecr.aws/docker/library/golang

# Version of Golang
ARG golang_version
# Version of eks-distro
ARG eks_distro_version

# Build the manager binary
FROM $builder_image:$golang_version as builder
Expand Down Expand Up @@ -49,7 +51,7 @@ RUN GIT_VERSION=$service_controller_git_version && \
-X ${VERSION_PKG}.BuildDate=${BUILD_DATE}" \
-a -o $work_dir/bin/controller $work_dir/cmd/controller/main.go

FROM $base_image
FROM $base_image:$eks_distro_version
ARG base_image
LABEL org.opencontainers.image.base.name=$base_image
ARG service_alias
Expand Down
7 changes: 5 additions & 2 deletions Dockerfile.local
Original file line number Diff line number Diff line change
@@ -1,12 +1,15 @@
# Base image to use at runtime
ARG base_image=public.ecr.aws/eks-distro-build-tooling/eks-distro-minimal-base-nonroot:2023-09-06-1694026927.2
ARG base_image=public.ecr.aws/eks-distro-build-tooling/eks-distro-minimal-base-nonroot

# Golang image to use for compiling the manager
ARG builder_image=public.ecr.aws/docker/library/golang

# Version of Golang
ARG golang_version

# Version of eks-distro
ARG eks_distro_version

# Build the manager binary
FROM $builder_image:$golang_version as builder

Expand Down Expand Up @@ -68,7 +71,7 @@ RUN GIT_VERSION=$service_controller_git_version && \
-X ${VERSION_PKG}.BuildDate=${BUILD_DATE}" \
-a -o $work_dir/bin/controller $work_dir/cmd/controller/main.go

FROM $base_image
FROM $base_image:$eks_distro_version
ARG base_image
LABEL org.opencontainers.image.base.name=$base_image
ARG service_alias
Expand Down
9 changes: 6 additions & 3 deletions scripts/build-controller-image.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ set -eo pipefail
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
SCRIPTS_DIR=$DIR
ROOT_DIR=$DIR/..
TEST_INFRA_DIR=$ROOT_DIR/../test-infra
DOCKERFILE_PATH=$ROOT_DIR/Dockerfile
ACK_DIR=$ROOT_DIR/..
DOCKERFILE=${DOCKERFILE:-"$DOCKERFILE_PATH"}
Expand Down Expand Up @@ -88,9 +89,10 @@ if ! is_public_ecr_logged_in; then
aws ecr-public get-login-password --region us-east-1 | docker login --username AWS --password-stdin public.ecr.aws
fi

pushd "$ROOT_DIR" 1>/dev/null
# Get the golang version from the code-generator
GOLANG_VERSION=${GOLANG_VERSION:-"$(go list -f {{.GoVersion}} -m)"}
pushd "$TEST_INFRA_DIR" 1>/dev/null
# Get the golang version from build_config.yaml
GOLANG_VERSION=$(cat build_config.yaml | yq .go_version)
BASE_IMAGE_VERSION=$(cat build_config.yaml | yq .eks_distro_version)
popd 1>/dev/null

# if local build
Expand All @@ -109,6 +111,7 @@ if ! docker build \
--build-arg service_controller_git_commit="$SERVICE_CONTROLLER_GIT_COMMIT" \
--build-arg build_date="$BUILD_DATE" \
--build-arg golang_version="${GOLANG_VERSION}" \
--build-arg eks_distro_version="${BASE_IMAGE_VERSION}" \
--build-arg go_arch="$GOARCH" \
--progress plain \
"${DOCKER_BUILD_CONTEXT}"; then
Expand Down