BASE ?= latest-alpine-jdk11 REGISTRY := public.ecr.aws/zero-downtime REPOSITORY := jenkins-podman # Parse version from latest git semver tag GTAG=$(shell git describe --tags --match v*.*.* 2>/dev/null || echo "v0.0.0") TAG ?= $(shell echo $(GTAG) | awk -F '-' '{ print $$1 "-" $$2 }' | sed -e 's/-$$//') ifeq ($(TRIVY_REMOTE),) TRIVY_OPTS := image else TRIVY_OPTS := client --remote ${TRIVY_REMOTE} endif .PHONY: build push scan all: build build: podman build --rm --squash-all --build-arg BASE=$(BASE) -t $(REPOSITORY):$(TAG) -t $(REPOSITORY):latest . push: aws ecr-public get-login-password --region us-east-1 | podman login --username AWS --password-stdin $(REGISTRY) podman tag $(REPOSITORY):latest $(REGISTRY)/$(REPOSITORY):$(TAG) $(REGISTRY)/$(REPOSITORY):latest podman push $(REGISTRY)/$(REPOSITORY):$(TAG) podman push $(REGISTRY)/$(REPOSITORY):latest scan: trivy $(TRIVY_OPTS) $(REPOSITORY):$(TAG)