2022-01-30 20:39:29 +00:00
|
|
|
# GOSEC_VERSION
|
|
|
|
# Only required to install a specifiy version
|
2023-02-06 14:02:31 +00:00
|
|
|
GOSEC_VERSION?=v2.15.0 # renovate: datasource=github-releases depName=securego/gosec
|
2022-01-30 20:39:29 +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-08-22 10:43:37 +00:00
|
|
|
CONTAINER_RUNTIME?=$(shell which podman)
|
2022-01-30 20:39:29 +00:00
|
|
|
|
2022-08-22 10:43:37 +00:00
|
|
|
# GOSEC_IMAGE_REGISTRY_NAME
|
2022-01-30 20:39:29 +00:00
|
|
|
# Defines the name of the new container to be built using several variables.
|
2022-08-22 10:43:37 +00:00
|
|
|
GOSEC_IMAGE_REGISTRY_NAME:=docker.io
|
|
|
|
GOSEC_IMAGE_REGISTRY_USER:=volkerraschek
|
2022-01-30 20:39:29 +00:00
|
|
|
|
2022-08-22 10:43:37 +00:00
|
|
|
GOSEC_IMAGE_NAMESPACE?=${GOSEC_IMAGE_REGISTRY_USER}
|
|
|
|
GOSEC_IMAGE_NAME:=gosec
|
|
|
|
GOSEC_IMAGE_VERSION?=latest
|
|
|
|
GOSEC_IMAGE_FULLY_QUALIFIED=${GOSEC_IMAGE_REGISTRY_NAME}/${GOSEC_IMAGE_NAMESPACE}/${GOSEC_IMAGE_NAME}:${GOSEC_IMAGE_VERSION}
|
|
|
|
GOSEC_IMAGE_UNQUALIFIED=${GOSEC_IMAGE_NAMESPACE}/${GOSEC_IMAGE_NAME}:${GOSEC_IMAGE_VERSION}
|
2022-01-30 20:39:29 +00:00
|
|
|
|
|
|
|
# BUILD CONTAINER IMAGE
|
|
|
|
# ==============================================================================
|
|
|
|
PHONY:=container-image/build
|
|
|
|
container-image/build:
|
|
|
|
${CONTAINER_RUNTIME} build \
|
|
|
|
--build-arg GOSEC_VERSION=${GOSEC_VERSION} \
|
|
|
|
--file Dockerfile \
|
|
|
|
--no-cache \
|
|
|
|
--pull \
|
2022-08-22 10:43:37 +00:00
|
|
|
--tag ${GOSEC_IMAGE_FULLY_QUALIFIED} \
|
|
|
|
--tag ${GOSEC_IMAGE_UNQUALIFIED} \
|
2022-01-30 20:39:29 +00:00
|
|
|
.
|
|
|
|
|
|
|
|
# DELETE CONTAINER IMAGE
|
|
|
|
# ==============================================================================
|
|
|
|
PHONY:=container-image/delete
|
|
|
|
container-image/delete:
|
2022-08-22 10:43:37 +00:00
|
|
|
- ${CONTAINER_RUNTIME} image rm ${GOSEC_IMAGE_FULLY_QUALIFIED} ${GOSEC_IMAGE_UNQUALIFIED}
|
2022-01-30 20:39:29 +00:00
|
|
|
- ${CONTAINER_RUNTIME} image rm ${BASE_IMAGE_FULL}
|
|
|
|
|
|
|
|
# PUSH CONTAINER IMAGE
|
|
|
|
# ==============================================================================
|
|
|
|
PHONY+=container-image/push
|
|
|
|
container-image/push:
|
2022-08-22 10:43:37 +00:00
|
|
|
echo ${GOSEC_IMAGE_REGISTRY_PASSWORD} | ${CONTAINER_RUNTIME} login ${GOSEC_IMAGE_REGISTRY_NAME} --username ${GOSEC_IMAGE_REGISTRY_USER} --password-stdin
|
|
|
|
${CONTAINER_RUNTIME} push ${GOSEC_IMAGE_FULLY_QUALIFIED}
|
2022-01-30 20:39:29 +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}
|