Created
March 7, 2019 19:17
-
-
Save vbatts/ab9e0dcf7aa3a36591b8669f5a85de0b to your computer and use it in GitHub Desktop.
I want repo:tag@digest from every layer in non-colliding values!
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ARG IMAGE=fedora | |
ARG IMAGE_TAG=29 | |
FROM ${IMAGE}:${IMAGE_TAG} | |
LABEL com.hashbangbash.image=${IMAGE}:${IMAGE_TAG}@${DIGEST} | |
LABEL com.hashbangbash.image.repo=${IMAGE} | |
LABEL com.hashbangbash.image.tag=${IMAGE_TAG} | |
LABEL com.hashbangbash.image.digest=${DIGEST} | |
RUN dnf update -y --refresh && \ | |
dnf install -y bip && \ | |
dnf clean all |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
OUTPUT ?= $(USER)/bip | |
CTR ?= podman | |
IMAGE ?= fedora | |
TAG ?= 29 | |
.PHONY: image | |
image: .digest | |
$(CTR) build \ | |
--build-arg "IMAGE=$(IMAGE)" \ | |
--build-arg "IMAGE_TAG=$(TAG)" \ | |
--build-arg "DIGEST=$(shell cat .digest)" \ | |
-t $(OUTPUT) \ | |
. | |
pull: | |
$(CTR) pull $(IMAGE):$(TAG) | |
.digest: pull | |
$(CTR) images --digests --format "{{.Digest}}" $(IMAGE):$(TAG) | head -1 | tee $@ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment