feat: make Dockerfile.test optional, improve messaging
This commit is contained in:
parent
cec5dcdece
commit
a4c2a55289
12
podman.mk
12
podman.mk
@ -14,14 +14,17 @@ all: test
|
|||||||
|
|
||||||
|
|
||||||
build:
|
build:
|
||||||
docker image exists $(IMAGE):$(TAG) || \
|
@docker image exists $(IMAGE):$(TAG) || \
|
||||||
docker build --rm -t $(IMAGE):$(TAG) --build-arg TAG=$(TAG) .
|
docker build --rm -t $(IMAGE):$(TAG) --build-arg TAG=$(TAG) .
|
||||||
|
|
||||||
test: build rm-test-image
|
test: build rm-test-image
|
||||||
docker build --rm -t $(IMAGE):$(TAG)-test --from=$(IMAGE):$(TAG) -f Dockerfile.test .
|
@test -f Dockerfile.test && \
|
||||||
|
docker build --rm -t $(IMAGE):$(TAG)-test --from=$(IMAGE):$(TAG) -f Dockerfile.test . || \
|
||||||
|
echo "No Dockerfile.test found, skipping test"
|
||||||
|
|
||||||
scan: build
|
scan: build
|
||||||
trivy $(TRIVY_OPTS) $(IMAGE):$(TAG)
|
@echo "Scanning $(IMAGE):$(TAG) using Trivy"
|
||||||
|
@trivy $(TRIVY_OPTS) $(IMAGE):$(TAG)
|
||||||
|
|
||||||
push: scan
|
push: scan
|
||||||
@aws ecr-public get-login-password --region $(REGION) | docker login --username AWS --password-stdin $(REGISTRY)
|
@aws ecr-public get-login-password --region $(REGION) | docker login --username AWS --password-stdin $(REGISTRY)
|
||||||
@ -34,7 +37,8 @@ clean: rm-test-image rm-image
|
|||||||
# Delete all untagged images
|
# Delete all untagged images
|
||||||
.PHONY: rm-remote-untagged
|
.PHONY: rm-remote-untagged
|
||||||
rm-remote-untagged:
|
rm-remote-untagged:
|
||||||
aws ecr-public batch-delete-image --repository-name $(IMAGE) --region $(REGION) --image-ids $$(for image in $$(aws ecr-public describe-images --repository-name $(IMAGE) --region $(REGION) --output json | jq -r '.imageDetails[] | select(.imageTags | not ).imageDigest'); do echo -n "imageDigest=$$image "; done)
|
@echo "Removing all untagged images from $(IMAGE) in $(REGION)"
|
||||||
|
@aws ecr-public batch-delete-image --repository-name $(IMAGE) --region $(REGION) --image-ids $$(for image in $$(aws ecr-public describe-images --repository-name $(IMAGE) --region $(REGION) --output json | jq -r '.imageDetails[] | select(.imageTags | not ).imageDigest'); do echo -n "imageDigest=$$image "; done)
|
||||||
|
|
||||||
.PHONY: rm-image
|
.PHONY: rm-image
|
||||||
rm-image:
|
rm-image:
|
||||||
|
Loading…
Reference in New Issue
Block a user