generated from ministryofjustice/analytical-platform-image-build-template
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
29 lines (24 loc) · 919 Bytes
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
IMAGE_NAME = ghcr.io/ministryofjustice/analytical-platform-kubectl:latest
ARCH = $(shell uname --machine)
define DOCKER_BUILD
@echo "Building on $(ARCH) architecture";
@if [ "$(ARCH)" = "aarch64" ] || [ "$(ARCH)" = "arm64" ]; then \
docker build --platform linux/amd64 --file Dockerfile --tag $(IMAGE_NAME) .; \
else \
docker build --file Dockerfile --tag $(IMAGE_NAME) .; \
fi
endef
define CONTAINER_TEST
@echo "Testing on $(ARCH) architecture";
@if [ "$(ARCH)" = "aarch64" ] || [ "$(ARCH)" = "arm64" ]; then \
container-structure-test test --platform linux/amd64 --config test/container-structure-test.yml --image $(IMAGE_NAME); \
else \
container-structure-test test --config test/container-structure-test.yml --image $(IMAGE_NAME); \
fi
endef
build:
$(DOCKER_BUILD)
test: build
$(CONTAINER_TEST)
scan: build
trivy image --vuln-type os,library --severity CRITICAL --exit-code 1 $(IMAGE_NAME)