From 0813b7652bc15d14c8b947d37d3cd11779d93312 Mon Sep 17 00:00:00 2001 From: Aaron U'Ren Date: Wed, 19 Oct 2022 16:38:02 -0500 Subject: [PATCH] feat(Makefile): make local builds behave like CI RUNTIME_BASE and BUILDTIME_BASE are both consumed in the Dockerfile and handle setting the base containers used for both building and running kube-router. These are handled differently in CI using GitHub actions than they are for local builds. This updates the Makefile so that local builds behave the same way that CI based builds in GitHub are when it comes to these bases. --- Makefile | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 64640e81..9beb8d2f 100644 --- a/Makefile +++ b/Makefile @@ -18,6 +18,10 @@ MAKEFILE_DIR=$(dir $(realpath $(firstword $(MAKEFILE_LIST)))) UPSTREAM_IMPORT_PATH=$(GOPATH)/src/github.com/cloudnativelabs/kube-router/ BUILD_IN_DOCKER?=true DOCKER_BUILD_IMAGE?=golang:1.19.2-alpine3.16 +## These variables are used by the Dockerfile as the bases for building and creating the runtime container +## During CI these come from .github/workflows/ci.yaml below we define for local builds as well +BUILDTIME_BASE?=$(DOCKER_BUILD_IMAGE) +RUNTIME_BASE?=alpine:3.16 DOCKER_LINT_IMAGE?=golangci/golangci-lint:v1.49.0 GOBGP_VERSION=v3.5.0 QEMU_IMAGE?=multiarch/qemu-user-static @@ -91,7 +95,8 @@ container: kube-router gobgp multiarch-binverify ## Builds a Docker container im echo "Using qemu to build non-native container"; \ $(DOCKER) run --rm --privileged $(QEMU_IMAGE) --reset -p yes; \ fi - $(DOCKER) build -t "$(REGISTRY_DEV):$(subst /,,$(IMG_TAG))" -f Dockerfile --build-arg ARCH="$(DOCKER_ARCH)" . + $(DOCKER) build -t "$(REGISTRY_DEV):$(subst /,,$(IMG_TAG))" -f Dockerfile --build-arg ARCH="$(DOCKER_ARCH)" \ + --build-arg BUILDTIME_BASE="$(BUILDTIME_BASE)" --build-arg RUNTIME_BASE="$(RUNTIME_BASE)" . @if [ "$(GIT_BRANCH)" = "master" ]; then \ $(DOCKER) tag "$(REGISTRY_DEV):$(IMG_TAG)" "$(REGISTRY_DEV)"; \ fi