Merge pull request #15 from mkilijanek/codex/add-docker-image-build-instructions

Add Makefile to build and publish multi-platform Docker images
This commit is contained in:
Kili 2025-12-25 21:36:16 +01:00 committed by GitHub
commit 2127d1a61d
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

41
Makefile Normal file
View File

@ -0,0 +1,41 @@
# Multi-platform Docker build and publish for CyberChef
IMAGE_NAME ?= ghcr.io/gchq/cyberchef
PLATFORMS ?= linux/amd64,linux/arm64
MONTHLY_TAG ?= $(shell date +%Y-%m)
.PHONY: check-branch build publish scan
check-branch:
@current=$$(git rev-parse --abbrev-ref HEAD); \
if [ "$$current" != "main" ]; then \
echo "Builds must run from the main branch (current: $$current)"; \
exit 1; \
fi
build: check-branch
docker buildx build \
--pull \
--platform $(PLATFORMS) \
--tag $(IMAGE_NAME):latest \
--tag $(IMAGE_NAME):$(MONTHLY_TAG) \
--sbom=true \
--provenance=true \
--output=type=docker \
.
publish: check-branch
docker buildx build \
--pull \
--platform $(PLATFORMS) \
--tag $(IMAGE_NAME):latest \
--tag $(IMAGE_NAME):$(MONTHLY_TAG) \
--sbom=true \
--provenance=true \
--push \
.
$(MAKE) scan
scan:
docker scout cves $(IMAGE_NAME):latest --only-severity critical,high || true
@echo "⚠️ Review High/Critical vulnerability findings above."