jq-docker/Makefile
Markus Pesch e15bf1bf2f
All checks were successful
continuous-integration/drone/push Build is passing
Initial Commit
2023-03-26 16:07:46 +02:00

52 lines
2.0 KiB
Makefile

# JQ_VERSION
# Only required to install a specifiy version
JQ_VERSION?=1.6-rc2 # renovate: datasource=github-releases depName=stedolan/jq
# 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.
CONTAINER_RUNTIME?=$(shell which podman)
# JQ_IMAGE_REGISTRY_NAME
# Defines the name of the new container to be built using several variables.
JQ_IMAGE_REGISTRY_NAME:=docker.io
JQ_IMAGE_REGISTRY_USER:=volkerraschek
JQ_IMAGE_NAMESPACE?=${JQ_IMAGE_REGISTRY_USER}
JQ_IMAGE_NAME:=jq
JQ_IMAGE_VERSION?=latest
JQ_IMAGE_FULLY_QUALIFIED=${JQ_IMAGE_REGISTRY_NAME}/${JQ_IMAGE_NAMESPACE}/${JQ_IMAGE_NAME}:${JQ_IMAGE_VERSION}
JQ_IMAGE_UNQUALIFIED=${JQ_IMAGE_NAMESPACE}/${JQ_IMAGE_NAME}:${JQ_IMAGE_VERSION}
# BUILD CONTAINER IMAGE
# ==============================================================================
PHONY:=container-image/build
container-image/build:
${CONTAINER_RUNTIME} build \
--build-arg JQ_VERSION=${JQ_VERSION} \
--file Dockerfile \
--no-cache \
--pull \
--tag ${JQ_IMAGE_FULLY_QUALIFIED} \
--tag ${JQ_IMAGE_UNQUALIFIED} \
.
# DELETE CONTAINER IMAGE
# ==============================================================================
PHONY:=container-image/delete
container-image/delete:
- ${CONTAINER_RUNTIME} image rm ${JQ_IMAGE_FULLY_QUALIFIED} ${JQ_IMAGE_UNQUALIFIED}
- ${CONTAINER_RUNTIME} image rm ${BASE_IMAGE_FULL}
# PUSH CONTAINER IMAGE
# ==============================================================================
PHONY+=container-image/push
container-image/push:
echo ${JQ_IMAGE_REGISTRY_PASSWORD} | ${CONTAINER_RUNTIME} login ${JQ_IMAGE_REGISTRY_NAME} --username ${JQ_IMAGE_REGISTRY_USER} --password-stdin
${CONTAINER_RUNTIME} push ${JQ_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}