fix(Makefile): use full container image names

This commit is contained in:
Markus Pesch 2020-01-19 14:15:38 +01:00
parent 8cc232adc1
commit cc317e0b6c
Signed by: volker.raschek
GPG Key ID: 852BCC170D81A982

View File

@ -61,33 +61,38 @@ EXECUTABLES:=\
EXECUTABLE_TARGETS:= \ EXECUTABLE_TARGETS:= \
${UNIX_EXECUTABLE_TARGETS} ${UNIX_EXECUTABLE_TARGETS}
# CONTAINER_RUNTIME / BUILD_IMAGE # CONTAINER_RUNTIME
# The CONTAINER_RUNTIME variable will be used to specified the path to a # The CONTAINER_RUNTIME variable will be used to specified the path to a
# container runtime. This is needed to start and run a container image defined # container runtime. This is needed to start and run a container images.
# by the BUILD_IMAGE variable.
CONTAINER_RUNTIME?=$(shell which docker) CONTAINER_RUNTIME?=$(shell which docker)
# BUILD_IMAGE # BUILD_IMAGE
# The BUILD_IMAGE container serve as build environment to execute the different # Definition of the container build image, in which the BInary are compiled from
# make steps inside. Therefore, the bulid environment requires all necessary # source code
# dependancies to build this project. BUILD_IMAGE_REGISTRY:=docker.io
BUILD_IMAGE:=docker.io/volkerraschek/build-image:latest BUILD_IMAGE_NAMESPACE:=volkerraschek
BUILD_IMAGE_NAME:=build-image
BUILD_IMAGE_VERSION:=latest
BUILD_IMAGE_FULL=${BUILD_IMAGE_REGISTRY}/${BUILD_IMAGE_NAMESPACE}/${BUILD_IMAGE_NAME}:${BUILD_IMAGE_VERSION:v%=%}
BUILD_IMAGE_SHORT=${BUILD_IMAGE_NAMESPACE}/${BUILD_IMAGE_NAME}:${BUILD_IMAGE_VERSION:v%=%}
# BASE_IMAGE # BASE_IMAGE
# Defines the name of the container base image on which should be built the new # Definition of the base container image for flucky
# CONTAINER_IMAGE. BASE_IMAGE_REGISTRY:=docker.io
BASE_IMAGE=docker.io/library/alpine:3.11.2 BASE_IMAGE_NAMESPACE:=library
BASE_IMAGE_NAME:=alpine
BASE_IMAGE_VERSION:=3.11.2
BASE_IMAGE_FULL=${BASE_IMAGE_REGISTRY}/${BASE_IMAGE_NAMESPACE}/${BASE_IMAGE_NAME}:${BASE_IMAGE_VERSION:v%=%}
BASE_IMAGE_SHORT=${BASE_IMAGE_NAMESPACE}/${BASE_IMAGE_NAME}:${BASE_IMAGE_VERSION:v%=%}
# REGISTRY / CONTAINER_IMAGE # CONTAINER_IMAGE
# Specification of the container registry. This is needed to build and push the # Definition of the container image for flucky
# container image on a container registry. Additionally, the CONTAINER_IMAGE CONTAINER_IMAGE_REGISTRY:=docker.io
# variable is composed based on the REGISTRY_NAMESPACE, the CONTAINER_IMAGE_NAME CONTAINER_IMAGE_NAMESPACE:=volkerraschek
# and the CONTAINER_IMAGE_VERSION
REGISTRY_MIRROR:=docker.io
REGISTRY_NAMESPACE:=volkerraschek
CONTAINER_IMAGE_NAME:=${EXECUTABLE} CONTAINER_IMAGE_NAME:=${EXECUTABLE}
CONTAINER_IMAGE_VERSION:=latest CONTAINER_IMAGE_VERSION:=latest
CONTAINER_IMAGE=${REGISTRY_NAMESPACE}/${CONTAINER_IMAGE_NAME}/${CONTAINER_IMAGE_VERSION:v%=%} CONTAINER_IMAGE_FULL=${CONTAINER_IMAGE_REGISTRY}/${CONTAINER_IMAGE_NAMESPACE}/${CONTAINER_IMAGE_NAME}:${CONTAINER_IMAGE_VERSION:v%=%}
CONTAINER_IMAGE_SHORT=${CONTAINER_IMAGE_NAMESPACE}/${CONTAINER_IMAGE_NAME}:${CONTAINER_IMAGE_VERSION:v%=%}
# BINARIES # BINARIES
# ============================================================================== # ==============================================================================
@ -213,8 +218,8 @@ clean:
PHONY+=container-image/build/amd64 PHONY+=container-image/build/amd64
container-image/build/amd64: container-image/build/amd64:
${CONTAINER_RUNTIME} build \ ${CONTAINER_RUNTIME} build \
--build-arg BASE_IMAGE=${BASE_IMAGE} \ --build-arg BASE_IMAGE=${BASE_IMAGE_FULL} \
--build-arg BUILD_IMAGE=${BUILD_IMAGE} \ --build-arg BUILD_IMAGE=${BUILD_IMAGE_FULL} \
--build-arg EXECUTABLE=${EXECUTABLE} \ --build-arg EXECUTABLE=${EXECUTABLE} \
--build-arg EXECUTABLE_TARGET=bin/linux/amd64/${EXECUTABLE} \ --build-arg EXECUTABLE_TARGET=bin/linux/amd64/${EXECUTABLE} \
--build-arg GOPROXY=${GOPROXY} \ --build-arg GOPROXY=${GOPROXY} \
@ -222,13 +227,13 @@ container-image/build/amd64:
--build-arg VERSION=${VERSION} \ --build-arg VERSION=${VERSION} \
--file Dockerfile \ --file Dockerfile \
--no-cache \ --no-cache \
--tag ${REGISTRY_MIRROR}/${CONTAINER_IMAGE} \ --tag ${CONTAINER_IMAGE_FULL} \
--tag ${CONTAINER_IMAGE} \ --tag ${CONTAINER_IMAGE_SHORT} \
. .
PHONY+=container-image/push/amd64 PHONY+=container-image/push/amd64
container-image/push/amd64: container-image/build/amd64 container-image/push/amd64: container-image/build/amd64
${CONTAINER_RUNTIME} push ${REGISTRY_MIRROR}/${CONTAINER_IMAGE} ${CONTAINER_RUNTIME} push ${CONTAINER_IMAGE_FULL}
# CONTAINER STEPS - BINARY # CONTAINER STEPS - BINARY
# ============================================================================== # ==============================================================================
@ -271,8 +276,10 @@ container-run:
${CONTAINER_RUNTIME} run \ ${CONTAINER_RUNTIME} run \
--rm \ --rm \
--volume ${PWD}:/workspace \ --volume ${PWD}:/workspace \
${BUILD_IMAGE} \ ${BUILD_IMAGE_FULL} \
make ${COMMAND} \ make ${COMMAND} \
GOPROXY=${GOPROXY} \
GOPRIVATE=${GOPRIVATE} \
VERSION=${VERSION:v%=%} \ VERSION=${VERSION:v%=%} \
RELEASE=${RELEASE} RELEASE=${RELEASE}