hydra-sql/Makefile

41 lines
1.4 KiB
Makefile
Raw Normal View History

2023-12-11 14:41:20 +01:00
IMAGE_REPO ?= reg.cadoles.com/cadoles
IMAGES_DIR := misc/images
IMAGES := $(foreach file, $(wildcard $(IMAGES_DIR)/*), $(basename $(notdir $(file))))
TRIVY_ARGS ?=
build-image: $(foreach image, $(IMAGES), build-image-$(image))
build-image-%:
docker build \
-t "${IMAGE_REPO}/$*:latest" \
-f ${IMAGES_DIR}/$*/Dockerfile \
.
scan-image: $(foreach image, $(IMAGES), scan-image-$(image))
scan-image-%: tools/trivy/bin/trivy
mkdir -p .trivy/.cache
tools/trivy/bin/trivy --cache-dir .trivy/.cache --ignorefile .trivyignore.yaml image $(TRIVY_ARGS) $(IMAGE_REPO)/$*:latest
release-image: $(foreach image, $(IMAGES), release-image-$(image))
release-image-%: .mktools
@[ ! -z "$(MKT_PROJECT_VERSION)" ] || ( echo "Just downloaded mktools. Please re-run command."; exit 1 )
docker tag "${IMAGE_REPO}/$*:latest" "${IMAGE_REPO}/$*:$(MKT_PROJECT_VERSION)"
docker tag "${IMAGE_REPO}/$*:latest" "${IMAGE_REPO}/$*:$(MKT_PROJECT_SHORT_VERSION)"
docker push "${IMAGE_REPO}/$*:$(MKT_PROJECT_VERSION)"
docker push "${IMAGE_REPO}/$*:$(MKT_PROJECT_SHORT_VERSION)"
docker push "${IMAGE_REPO}/$*:latest"
tools/trivy/bin/trivy:
mkdir -p tools/trivy/bin
curl -sfL https://raw.githubusercontent.com/aquasecurity/trivy/main/contrib/install.sh | sh -s -- -b ./tools/trivy/bin v0.47.0
.mktools:
rm -rf .mktools
curl -q https://forge.cadoles.com/Cadoles/mktools/raw/branch/master/install.sh | TASKS="version" $(SHELL)
-include .mktools/*.mk