network-tools/Makefile

47 lines
2.1 KiB
Makefile
Raw Permalink Normal View History

2020-03-13 12:20:53 +00:00
# CONTAINER_RUNTIME
2020-06-06 17:05:16 +00:00
# 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-07-14 16:14:31 +00:00
CONTAINER_RUNTIME?=$(shell which podman)
2020-03-13 12:20:53 +00:00
# NETWORKTOOLS_IMAGE_REGISTRY_NAME
2020-06-06 17:05:16 +00:00
# Defines the name of the new container to be built using several variables.
NETWORKTOOLS_IMAGE_REGISTRY_NAME:=docker.io
NETWORKTOOLS_IMAGE_REGISTRY_USER:=volkerraschek
2020-06-06 17:05:16 +00:00
NETWORKTOOLS_IMAGE_NAMESPACE?=${NETWORKTOOLS_IMAGE_REGISTRY_USER}
NETWORKTOOLS_IMAGE_NAME:=network-tools
NETWORKTOOLS_IMAGE_VERSION?=latest
NETWORKTOOLS_IMAGE_FULLY_QUALIFIED=${NETWORKTOOLS_IMAGE_REGISTRY_NAME}/${NETWORKTOOLS_IMAGE_NAMESPACE}/${NETWORKTOOLS_IMAGE_NAME}:${NETWORKTOOLS_IMAGE_VERSION}
NETWORKTOOLS_IMAGE_UNQUALIFIED=${NETWORKTOOLS_IMAGE_NAMESPACE}/${NETWORKTOOLS_IMAGE_NAME}:${NETWORKTOOLS_IMAGE_VERSION}
2020-03-13 12:20:53 +00:00
2020-06-06 17:05:16 +00:00
# BUILD CONTAINER IMAGE
2020-03-13 12:20:53 +00:00
# ==============================================================================
2020-06-06 17:05:16 +00:00
PHONY:=container-image/build
2020-03-13 12:20:53 +00:00
container-image/build:
${CONTAINER_RUNTIME} build \
2020-06-06 17:05:16 +00:00
--file Dockerfile \
2020-03-13 12:20:53 +00:00
--no-cache \
2020-06-06 17:05:16 +00:00
--pull \
--tag ${NETWORKTOOLS_IMAGE_FULLY_QUALIFIED} \
--tag ${NETWORKTOOLS_IMAGE_UNQUALIFIED} \
2020-03-13 12:20:53 +00:00
.
# DELETE CONTAINER IMAGE
# ==============================================================================
PHONY:=container-image/delete
container-image/delete:
- ${CONTAINER_RUNTIME} image rm ${NETWORKTOOLS_IMAGE_FULLY_QUALIFIED} ${NETWORKTOOLS_IMAGE_UNQUALIFIED}
- ${CONTAINER_RUNTIME} image rm ${BASE_IMAGE_FULL}
2020-06-06 17:05:16 +00:00
# PUSH CONTAINER IMAGE
# ==============================================================================
2020-03-13 12:20:53 +00:00
PHONY+=container-image/push
2020-06-06 17:05:16 +00:00
container-image/push:
echo ${NETWORKTOOLS_IMAGE_REGISTRY_PASSWORD} | ${CONTAINER_RUNTIME} login ${NETWORKTOOLS_IMAGE_REGISTRY_NAME} --username ${NETWORKTOOLS_IMAGE_REGISTRY_USER} --password-stdin
${CONTAINER_RUNTIME} push ${NETWORKTOOLS_IMAGE_FULLY_QUALIFIED}
2021-01-09 12:03:00 +00:00
2020-03-13 12:20:53 +00:00
# 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}