diff options
-rw-r--r-- | .travis.yml | 12 | ||||
-rw-r--r-- | Makefile | 14 |
2 files changed, 14 insertions, 12 deletions
diff --git a/.travis.yml b/.travis.yml index 54118de..f655d78 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,5 +1,5 @@ os: linux -dist: bionic +dist: focal language: minimal jobs: @@ -17,12 +17,6 @@ jobs: - stage: publish name: 'Docker: build & publish multi-arch images' if: branch = master - addons: - apt: - # Newer docker for BuildKit/buildx support: - packages: - - docker-ce - sources: - - key_url: 'https://download.docker.com/linux/ubuntu/gpg' - sourceline: 'deb https://download.docker.com/linux/ubuntu "$(lsb_release -cs)" stable' + # buildx isn't installed on Focal. + before_install: make buildx/install script: make login && make buildx/create && make buildx/push @@ -11,9 +11,11 @@ PROJECT := cgit-repos # Enable buildx support: export DOCKER_CLI_EXPERIMENTAL := enabled # Target platforms (used by buildx): -platforms := linux/amd64,linux/armhf +PLATFORMS := linux/amd64,linux/armhf # Docker Hub credentials: DOCKER_USERNAME := egortensin +# In case buildx isn't installed (e.g. on Ubuntu): +BUILDX_VERSION := v0.4.2 .PHONY: all all: build @@ -70,6 +72,12 @@ docker/push: check-push docker/build fix-binfmt: docker run --rm --privileged docker/binfmt:66f9012c56a8316f9244ffd7622d7c21c1f6f28d +.PHONY: buildx/install +buildx/install: + mkdir -p -- ~/.docker/cli-plugins/ + curl --silent --show-error --location -- 'https://github.com/docker/buildx/releases/download/$(BUILDX_VERSION)/buildx-$(BUILDX_VERSION).linux-amd64' > ~/.docker/cli-plugins/docker-buildx + chmod +x -- ~/.docker/cli-plugins/docker-buildx + .PHONY: buildx/create buildx/create: fix-binfmt docker buildx create --use --name "$(PROJECT)_builder" @@ -80,8 +88,8 @@ buildx/rm: .PHONY: buildx/build buildx/build: - docker buildx build -t "$(DOCKER_USERNAME)/$(PROJECT)" --platform "$(platforms)" --progress plain . + docker buildx build -t "$(DOCKER_USERNAME)/$(PROJECT)" --platform "$(PLATFORMS)" --progress plain . .PHONY: buildx/push buildx/push: - docker buildx build -t "$(DOCKER_USERNAME)/$(PROJECT)" --platform "$(platforms)" --progress plain --push . + docker buildx build -t "$(DOCKER_USERNAME)/$(PROJECT)" --platform "$(PLATFORMS)" --progress plain --push . |