initial commit
This commit is contained in:
commit
cf491a2743
|
@ -0,0 +1,2 @@
|
|||
out*
|
||||
run*
|
|
@ -0,0 +1,63 @@
|
|||
default: env-test
|
||||
@make -f test.mk OUT=out2
|
||||
@make -f test.mk OUT=out1
|
||||
@printf "Docker Version: %s\n" "$(shell docker --version)"
|
||||
@printf "Docker Image Store: %s\n" "$(shell docker info -f '{{ .DriverStatus }} ')"
|
||||
@for f in out1 out2; do \
|
||||
printf "%-35s" "$${f} - docker save archive hash: "; \
|
||||
sha256sum $${f}/dockersave.tar | awk '{ print $$1 }'; \
|
||||
done
|
||||
@for f in out1 out2; do \
|
||||
printf "%-35s" "$${f} - docker buildx archive hash: "; \
|
||||
sha256sum $${f}/buildx.tar | awk '{ print $$1 }'; \
|
||||
done
|
||||
@for f in out1 out2; do \
|
||||
printf "%-35s" "$${f} - docker save digest: "; \
|
||||
tar -xf $${f}/dockersave.tar index.json -O | jq -r '.manifests[].digest | sub("sha256:";"")'; \
|
||||
done
|
||||
@for f in out1 out2; do \
|
||||
printf "%-35s" "$${f} - docker buildx digest: "; \
|
||||
tar -xf $${f}/buildx.tar index.json -O | jq -r '.manifests[].digest | sub("sha256:";"")'; \
|
||||
done
|
||||
@diffoscope --exclude-directory-metadata=yes out1 out2
|
||||
|
||||
.PHONY: clean
|
||||
clean:
|
||||
docker container rm -f $$(cat $(OUT)/registry.id)
|
||||
docker buildx rm digest-test
|
||||
rm -rf out1 out2
|
||||
|
||||
.PHONY: env-test
|
||||
env-test:
|
||||
which jq
|
||||
which docker
|
||||
|
||||
run:
|
||||
mkdir $@
|
||||
|
||||
run/registry.id: run
|
||||
docker container create \
|
||||
--publish 5000:5000 \
|
||||
--restart always \
|
||||
--name test-registry \
|
||||
registry:2 \
|
||||
> $@
|
||||
|
||||
run/registry.run: run/registry.id
|
||||
docker container start $$(cat run/registry.id)
|
||||
touch $@
|
||||
|
||||
run/driver.run: run
|
||||
docker buildx create \
|
||||
--name digest-test \
|
||||
--driver docker-container \
|
||||
--node digest-test
|
||||
docker buildx use digest-test
|
||||
touch $@
|
||||
|
||||
run/driver.run: run
|
||||
docker buildx create \
|
||||
--name digest-test \
|
||||
--driver docker-container \
|
||||
--node digest-test
|
||||
touch $@
|
|
@ -0,0 +1,37 @@
|
|||
OUT =: $(OUT)
|
||||
|
||||
default: all
|
||||
|
||||
.PHONY: all
|
||||
all: $(OUT)/dockersave.tar $(OUT)/buildx.tar $(OUT)/metadata.json
|
||||
touch -hcd "@0" $(OUT)/*
|
||||
sha256sum $(OUT)/dockersave.tar
|
||||
sha256sum $(OUT)/buildx.tar
|
||||
|
||||
$(OUT):
|
||||
mkdir -p $(OUT)
|
||||
|
||||
$(OUT)/Dockerfile $(OUT)/noopfile: $(OUT)
|
||||
printf "from scratch\nADD noopfile ." > $(OUT)/Dockerfile
|
||||
printf "1" > $(OUT)/noopfile
|
||||
touch -hcd "@0" $(OUT)/noopfile
|
||||
|
||||
$(OUT)/buildx.tar $(OUT)/buildx_metadata.json: $(OUT)/Dockerfile
|
||||
DOCKER_BUILDKIT=1 \
|
||||
SOURCE_DATE_EPOCH=1 \
|
||||
/bin/docker buildx build \
|
||||
--tag local/digest-test \
|
||||
--no-cache \
|
||||
--metadata-file $(OUT)/metadata.json \
|
||||
--output type=oci,force-compression=true,name=local/digest-test,dest=$(OUT)/buildx.tar \
|
||||
$(OUT)
|
||||
|
||||
$(OUT)/dockersave.tar: $(OUT)/Dockerfile
|
||||
DOCKER_BUILDKIT=1 \
|
||||
SOURCE_DATE_EPOCH=1 \
|
||||
/bin/docker buildx build \
|
||||
--tag local/digest-test \
|
||||
--no-cache \
|
||||
--load \
|
||||
$(OUT)
|
||||
docker save local/digest-test -o $@
|
Loading…
Reference in New Issue