Use Zstandard to transfer Docker images between CI jobs

This commit is contained in:
Héctor Molinero Fernández 2021-01-15 19:35:12 +01:00
parent 7687a6b533
commit 8f0793db9e
2 changed files with 5 additions and 5 deletions

View File

@ -17,7 +17,7 @@ default:
build:images: build:images:
stage: 'build:images' stage: 'build:images'
before_script: before_script:
- 'apk add --no-cache coreutils git make xz' - 'apk add --no-cache coreutils git make zstd'
script: script:
- 'make IMAGE_BUILD_OPTS="--pull" build-image save-image' - 'make IMAGE_BUILD_OPTS="--pull" build-image save-image'
artifacts: artifacts:
@ -32,7 +32,7 @@ push:images:
only: only:
- '/^v[0-9]+$/' - '/^v[0-9]+$/'
before_script: before_script:
- 'apk add --no-cache coreutils git make xz' - 'apk add --no-cache coreutils git make zstd'
- 'docker login -u "${CI_REGISTRY_USER:?}" -p "${CI_REGISTRY_PASSWORD:?}" "${CI_REGISTRY:?}"' - 'docker login -u "${CI_REGISTRY_USER:?}" -p "${CI_REGISTRY_PASSWORD:?}" "${CI_REGISTRY:?}"'
script: script:
- 'make load-image push-image' - 'make load-image push-image'

View File

@ -22,7 +22,7 @@ endif


IMAGE_BUILD_OPTS := IMAGE_BUILD_OPTS :=


IMAGE_TARBALL := $(DISTDIR)/$(IMAGE_PROJECT).txz IMAGE_TARBALL := $(DISTDIR)/$(IMAGE_PROJECT).tzst


################################################## ##################################################
## "all" target ## "all" target
@ -47,7 +47,7 @@ build-image:
################################################## ##################################################


define save_image define save_image
'$(DOCKER)' save '$(1)' | xz -T0 > '$(2)' '$(DOCKER)' save '$(1)' | zstd -T0 -19 > '$(2)'
endef endef


.PHONY: save-image .PHONY: save-image
@ -62,7 +62,7 @@ $(IMAGE_TARBALL): build-image
################################################## ##################################################


define load_image define load_image
'$(DOCKER)' load -i '$(1)' zstd -dc '$(1)' | '$(DOCKER)' load
endef endef


define tag_image define tag_image