build-image/Makefile

63 lines
2.6 KiB
Makefile
Raw Permalink Normal View History

# CONTAINER_RUNTIME
# The CONTAINER_RUNTIME variable will be used to specified the path to a
2020-06-06 15:24:05 +00:00
# container runtime. This is needed to start and run a container image.
CONTAINER_RUNTIME?=$(shell which podman)
2020-06-06 15:24:05 +00:00
# CONTAINER_IMAGE
2020-06-06 15:24:05 +00:00
# Defines the name of the new container to be built using several variables.
2023-06-18 13:24:20 +00:00
BUILD_IMAGE_REGISTRY_HOST:=git.cryptic.systems
BUILD_IMAGE_REGISTRY_USER:=volker.raschek
2021-08-31 20:39:00 +00:00
BUILD_IMAGE_NAMESPACE?=${BUILD_IMAGE_REGISTRY_USER}
BUILD_IMAGE_REPOSITORY:=build-image
BUILD_IMAGE_VERSION?=latest
BUILD_IMAGE_FULLY_QUALIFIED=${BUILD_IMAGE_REGISTRY_HOST}/${BUILD_IMAGE_NAMESPACE}/${BUILD_IMAGE_REPOSITORY}:${BUILD_IMAGE_VERSION}
BUILD_IMAGE_UNQUALIFIED=${BUILD_IMAGE_NAMESPACE}/${BUILD_IMAGE_REPOSITORY}:${BUILD_IMAGE_VERSION}
2024-04-19 20:03:59 +00:00
# MARKDOWNLINT_IMAGE
MARKDOWNLINT_IMAGE_REGISTRY_HOST?=docker.io
MARKDOWNLINT_IMAGE_REPOSITORY=volkerraschek/markdownlint
MARKDOWNLINT_IMAGE_VERSION?=0.39.0 # renovate: datasource=docker registryUrl=https://docker.io depName=volkerraschek/markdownlint
MARKDOWNLINT_IMAGE_FULLY_QUALIFIED=${MARKDOWNLINT_IMAGE_REGISTRY_HOST}/${MARKDOWNLINT_IMAGE_REPOSITORY}:${MARKDOWNLINT_IMAGE_VERSION}
# BUILD CONTAINER IMAGE
# ==============================================================================
2020-06-06 15:24:05 +00:00
PHONY:=container-image/build
container-image/build:
${CONTAINER_RUNTIME} build \
--file Dockerfile \
--no-cache \
2020-06-06 15:24:05 +00:00
--pull \
2021-08-31 20:39:00 +00:00
--tag ${BUILD_IMAGE_FULLY_QUALIFIED} \
--tag ${BUILD_IMAGE_UNQUALIFIED} \
2019-04-18 15:33:44 +00:00
.
# DELETE CONTAINER IMAGE
# ==============================================================================
PHONY:=container-image/delete
container-image/delete:
2021-08-31 20:39:00 +00:00
- ${CONTAINER_RUNTIME} image rm ${BUILD_IMAGE_FULLY_QUALIFIED} ${BUILD_IMAGE_UNQUALIFIED}
- ${CONTAINER_RUNTIME} image rm ${BASE_IMAGE_FULLY_QUALIFIED}
# PUSH CONTAINER IMAGE
# ==============================================================================
2020-06-06 15:24:05 +00:00
PHONY+=container-image/push
container-image/push:
2021-09-01 06:57:34 +00:00
echo ${BUILD_IMAGE_REGISTRY_PASSWORD} | ${CONTAINER_RUNTIME} login ${BUILD_IMAGE_REGISTRY_HOST} --username ${BUILD_IMAGE_REGISTRY_USER} --password-stdin
2021-08-31 20:39:00 +00:00
${CONTAINER_RUNTIME} push ${BUILD_IMAGE_FULLY_QUALIFIED}
2021-01-09 11:48:37 +00:00
2024-04-19 20:03:59 +00:00
# CONTAINER RUN - MARKDOWN-LINT
# ==============================================================================
PHONY+=container-run/markdown-lint
container-run/markdown-lint:
${CONTAINER_RUNTIME} run \
--rm \
--volume $(shell pwd):/work \
${MARKDOWNLINT_IMAGE_FULLY_QUALIFIED} \
*.md
# 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}