diff options
author | Alejandro Colomar <alx.manpages@gmail.com> | 2021-04-09 22:24:39 +0200 |
---|---|---|
committer | Alejandro Colomar <alx.manpages@gmail.com> | 2021-04-09 23:20:18 +0200 |
commit | 498ad2f9d9b991d0919052d1ae8e36c089dee5a5 (patch) | |
tree | 64760fc321245351cde351c8f6e59920e89ee027 | |
parent | db56735d5b872a67fffd9a7337b81dfcb2b0ee9e (diff) |
Makefile: create multi-arch images in a single machine
Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
-rw-r--r-- | .github/workflows/ci-push.yaml | 4 | ||||
-rw-r--r-- | Makefile | 16 | ||||
-rw-r--r-- | README.rst | 24 |
3 files changed, 22 insertions, 22 deletions
diff --git a/.github/workflows/ci-push.yaml b/.github/workflows/ci-push.yaml index ee3f8cd..2d9724b 100644 --- a/.github/workflows/ci-push.yaml +++ b/.github/workflows/ci-push.yaml @@ -35,10 +35,8 @@ jobs: run: make config; - name: make image - run: make image; - - - name: docker image tag run: | + make image-build; docker image tag \ 'alejandrocolomar/www:ci_x86_64' \ 'alejandrocolomar/www:ci'; @@ -110,7 +110,6 @@ builddirs-html: .PHONY: man man: man-pages man-pages-posix - .PHONY: man-pages man-pages: $(MAKE) html MANDIR_='$(CURDIR)/src/$@'; @@ -160,7 +159,15 @@ installdirs-man: done; .PHONY: image -image: Dockerfile submodules +image: submodules + @for arch in $(archs); do \ + $(MAKE) image-build arch=$${arch} || exit $$?; \ + $(MAKE) image-push arch=$${arch} || exit $$?; \ + done; + @$(MAKE) image-manifest; + +.PHONY: image-build +image-build: Dockerfile @echo ' DOCKER image build $(img_)'; @docker image build -t '$(img_)' $(CURDIR); @@ -171,6 +178,11 @@ image-push: .PHONY: image-manifest image-manifest: + @$(MAKE) image-manifest-create; + @$(MAKE) image-manifest-push; + +.PHONY: image-manifest-create +image-manifest-create: @echo ' DOCKER manifest create $(img)'; @docker manifest create '$(img)' $(imgs); @@ -22,26 +22,16 @@ Release a stable version ./bin/release_stable X.Y; git push origin vX.Y; -Build and push arch-specific Docker images -^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +Build and push multi-arch Docker images and an image manifest +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -The image will have the architecture of the machine in which it is run. -For various architectures, simply run in various machines. +This creates and pushes images for all the supported architectures from +a single building machine, and also a multi-arch manifest. This command +also stores the digest of the created images in ``<./etc/docker/images/www>``. .. code-block:: BASH - make image && make image-push; - -Build and push multi-arch Docker image manifest -^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - -This step requires that arch-specific images of all supported architectures -are already pushed to the Docker registry (see -`Build and push arch-specific Docker images`_). - -.. code-block:: BASH - - make image-manifest && make image-manifest-push; + make image; Specify the digests of the multi-arch Docker image manifest ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -93,7 +83,7 @@ For a seamless deployment, the following steps need to be done: - `Pre-release a test version`_ (see above). -- `Build and push multi-arch Docker image manifest`_ (see above). +- `Build and push multi-arch Docker images and an image manifest`_ (see above). - Deploy the test pre-release at port 31001: |