From 145b2c23ddd03d71c88a622923653edd6ffe8969 Mon Sep 17 00:00:00 2001 From: Kevin Griffin Date: Tue, 30 Jul 2024 11:43:44 -0400 Subject: [PATCH] adds docker build for multiple architectures Signed-off-by: Kevin Griffin --- Makefile | 39 ++++++++++++++++++++++++----------- README.md | 14 +++++++++++++ images/keripy.base.dockerfile | 15 -------------- images/keripy.dockerfile | 2 +- 4 files changed, 42 insertions(+), 28 deletions(-) delete mode 100644 images/keripy.base.dockerfile diff --git a/Makefile b/Makefile index 4ef478940..f34d1bd4e 100644 --- a/Makefile +++ b/Makefile @@ -1,19 +1,34 @@ .PHONY: build-keri -build-keri: - @docker buildx build --platform=linux/amd64 -f images/keripy.dockerfile --tag weboftrust/keri:1.2.0-dev12 . - @docker buildx build --platform=linux/arm64 -f images/keripy.dockerfile --tag weboftrust/keri:1.2.0-dev12-arm64 . -.PHONY: build-witness-demo -build-witness-demo: - @@docker buildx build --platform=linux/amd64 -f images/witness.demo.dockerfile --tag weboftrust/keri-witness-demo:1.1.10 . - @@docker buildx build --platform=linux/arm64 -f images/witness.demo.dockerfile --tag weboftrust/keri-witness-demo:1.1.10-arm64 . +VERSION=MULTI_ARCH_TEST -.PHONY: publish-keri -publish-keri: - @docker push weboftrust/keri:1.2.0-dev12 - @docker push weboftrust/keri:1.2.0-dev12-arm64 +define DOCKER_WARNING +In order to use the multi-platform build enable the containerd image store +The containerd image store is not enabled by default. +To enable the feature for Docker Desktop: + Navigate to Settings in Docker Desktop. + In the General tab, check Use containerd for pulling and storing images. + Select Apply and Restart." +endef + +build-keri: .warn + @docker build --platform=linux/amd64,linux/arm64 -f images/keripy.dockerfile -t weboftrust/keri:$(VERSION) . + +.PHONY: build-witness-demo +build-witness-demo: .warn + @docker build --platform=linux/amd64,linux/arm64 -f images/witness.demo.dockerfile -t weboftrust/keri-witness-demo:1.1.10 . .PHONY: publish-keri-witness-demo publish-keri-witness-demo: - @docker push weboftrust/keri-witness-demo --all-tags \ No newline at end of file + @docker push weboftrust/keri-witness-demo --all-tags + +publish-keri: + @docker push weboftrust/keri:$(VERSION) + +.warn: + @echo -e ${RED}"$$DOCKER_WARNING"${NO_COLOUR} + +RED="\033[0;31m" +NO_COLOUR="\033[0m" +export DOCKER_WARNING diff --git a/README.md b/README.md index 935f53a63..7b31c7e0c 100644 --- a/README.md +++ b/README.md @@ -88,3 +88,17 @@ pytest tests/demo/ * Build with Sphinx in `/docs`: * `$ make html` +## Publishing containers + +Enable the containerd image store + +The containerd image store isn't enabled by default. To enable the feature for Docker Desktop: + +Navigate to Settings in Docker Desktop. +In the General tab, check Use containerd for pulling and storing images. +Select Apply & Restart. + +```angular2html +make build-keri +make publish-keri +``` \ No newline at end of file diff --git a/images/keripy.base.dockerfile b/images/keripy.base.dockerfile deleted file mode 100644 index 23de45f8d..000000000 --- a/images/keripy.base.dockerfile +++ /dev/null @@ -1,15 +0,0 @@ -# Builder layer -FROM python:3.12-alpine as builder - -# Install compilation dependencies -RUN apk --no-cache add \ - bash \ - alpine-sdk \ - libffi-dev \ - libsodium \ - libsodium-dev - -SHELL ["/bin/bash", "-c"] - -# Setup Rust for blake3 dependency build -RUN curl https://sh.rustup.rs -sSf | bash -s -- -y diff --git a/images/keripy.dockerfile b/images/keripy.dockerfile index 9cc82212c..5591bc801 100644 --- a/images/keripy.dockerfile +++ b/images/keripy.dockerfile @@ -1,6 +1,6 @@ ARG BASE=python:3.12.3-alpine3.20 -FROM ${BASE} as builder +FROM ${BASE} AS builder RUN apk add --no-cache bash