createrepo-docker/Makefile

53 lines
2.2 KiB
Makefile
Raw Permalink Normal View History

2022-05-03 07:42:57 +00:00
# CREATEREPO_VERSION
# Only required to install a specifiy version
2023-07-08 16:44:22 +00:00
CREATEREPO_VERSION?=0.20.1
2022-05-03 07:42:57 +00:00
# CONTAINER_RUNTIME
# 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.
2022-05-03 15:27:02 +00:00
CONTAINER_RUNTIME?=$(shell which podman)
2022-05-03 07:42:57 +00:00
# CREATEREPO_IMAGE_REGISTRY_NAME
# Defines the name of the new container to be built using several variables.
CREATEREPO_IMAGE_REGISTRY_NAME:=docker.io
CREATEREPO_IMAGE_REGISTRY_USER:=volkerraschek
CREATEREPO_IMAGE_NAMESPACE?=${CREATEREPO_IMAGE_REGISTRY_USER}
CREATEREPO_IMAGE_NAME:=createrepo
CREATEREPO_IMAGE_VERSION?=latest
CREATEREPO_IMAGE_FULLY_QUALIFIED=${CREATEREPO_IMAGE_REGISTRY_NAME}/${CREATEREPO_IMAGE_NAMESPACE}/${CREATEREPO_IMAGE_NAME}:${CREATEREPO_IMAGE_VERSION}
CREATEREPO_IMAGE_UNQUALIFIED=${CREATEREPO_IMAGE_NAMESPACE}/${CREATEREPO_IMAGE_NAME}:${CREATEREPO_IMAGE_VERSION}
# BUILD CONTAINER IMAGE
# ==============================================================================
PHONY:=container-image/build
container-image/build:
${CONTAINER_RUNTIME} build \
--build-arg CREATEREPO_VERSION=${CREATEREPO_VERSION} \
--file Dockerfile \
--no-cache \
--pull \
--tag ${CREATEREPO_IMAGE_FULLY_QUALIFIED} \
--tag ${CREATEREPO_IMAGE_UNQUALIFIED} \
.
# DELETE CONTAINER IMAGE
# ==============================================================================
PHONY:=container-image/delete
container-image/delete:
- ${CONTAINER_RUNTIME} image rm ${CREATEREPO_IMAGE_FULLY_QUALIFIED} ${CREATEREPO_IMAGE_UNQUALIFIED}
- ${CONTAINER_RUNTIME} image rm ${BASE_IMAGE_FULL}
# PUSH CONTAINER IMAGE
# ==============================================================================
PHONY+=container-image/push
container-image/push:
echo ${CREATEREPO_IMAGE_REGISTRY_PASSWORD} | ${CONTAINER_RUNTIME} login ${CREATEREPO_IMAGE_REGISTRY_NAME} --username ${CREATEREPO_IMAGE_REGISTRY_USER} --password-stdin
${CONTAINER_RUNTIME} push ${CREATEREPO_IMAGE_FULLY_QUALIFIED}
# PHONY
# ==============================================================================
# Declare the contents of the PHONY variable as phony. We keep that information
# in a variable so we can use it in if_changed.
.PHONY: ${PHONY}