From 5539c646ecb5c3cb38a7664e1b5ac73e97bed843 Mon Sep 17 00:00:00 2001 From: asonix Date: Mon, 8 Jun 2020 14:37:24 -0500 Subject: [PATCH] Move prod dockerfiles to prod folder, work on manifests --- docker/{dev => prod}/Dockerfile.amd64 | 0 docker/{dev => prod}/Dockerfile.arm32v7 | 0 docker/{dev => prod}/Dockerfile.arm64v8 | 0 docker/{dev => prod}/deploy.sh | 11 ++----- docker/prod/manifest.sh | 43 +++++++++++++++++++++++++ 5 files changed, 45 insertions(+), 9 deletions(-) rename docker/{dev => prod}/Dockerfile.amd64 (100%) rename docker/{dev => prod}/Dockerfile.arm32v7 (100%) rename docker/{dev => prod}/Dockerfile.arm64v8 (100%) rename docker/{dev => prod}/deploy.sh (79%) create mode 100755 docker/prod/manifest.sh diff --git a/docker/dev/Dockerfile.amd64 b/docker/prod/Dockerfile.amd64 similarity index 100% rename from docker/dev/Dockerfile.amd64 rename to docker/prod/Dockerfile.amd64 diff --git a/docker/dev/Dockerfile.arm32v7 b/docker/prod/Dockerfile.arm32v7 similarity index 100% rename from docker/dev/Dockerfile.arm32v7 rename to docker/prod/Dockerfile.arm32v7 diff --git a/docker/dev/Dockerfile.arm64v8 b/docker/prod/Dockerfile.arm64v8 similarity index 100% rename from docker/dev/Dockerfile.arm64v8 rename to docker/prod/Dockerfile.arm64v8 diff --git a/docker/dev/deploy.sh b/docker/prod/deploy.sh similarity index 79% rename from docker/dev/deploy.sh rename to docker/prod/deploy.sh index 21392f8..593a489 100755 --- a/docker/dev/deploy.sh +++ b/docker/prod/deploy.sh @@ -50,7 +50,7 @@ set -xe git checkout master # Changing the docker-compose prod -sed -i "s/asonix\/pictrs:.*/asonix\/pictrs:amd64-$new_tag/" ../prod/docker-compose.yml +sed -i "s/asonix\/pictrs:.*/asonix\/pictrs:amd64-$new_tag/" docker-compose.yml git add ../prod/docker-compose.yml # The commit @@ -61,14 +61,7 @@ git tag $new_tag git push origin $new_tag git push -# Rebuilding docker -# docker-compose build -# docker tag dev_pictrs:latest asonix/pictrs:x64-$new_tag-dev -# docker tag dev_pictrs:latest asonix/pictrs:x64-latest-dev -# docker push asonix/pictrs:x64-$new_tag-dev -# docker push asonix/pictrs:x64-latest-dev - -# Build for arm64v8 and arm32v7 +# Build for arm64v8, arm32v7, and amd64 build_image $new_tag arm64v8 build_image $new_tag arm32v7 build_image $new_tag amd64 diff --git a/docker/prod/manifest.sh b/docker/prod/manifest.sh new file mode 100755 index 0000000..c72e492 --- /dev/null +++ b/docker/prod/manifest.sh @@ -0,0 +1,43 @@ +#!/usr/bin/env bash + +function require() { + if [ "$1" = "" ]; then + echo "input '$2' required" + print_help + exit 1 + fi +} +function print_help() { + echo "deploy.sh" + echo "" + echo "Usage:" + echo " manifest.sh [tag]" + echo "" + echo "Args:" + echo " tag: The git tag to be applied to the image manifest" +} + +function annotate() { + tag=$1 + arch=$2 + + docker manifest annotate asonix/pictrs:$tag \ + asonix/pictrs:$arch-$tag --os linux --arch $arch +} + +new_tag=$1 + +require "$new_tag" "tag" + +set -xe + +docker manifest create asonix/pictrs:$new_tag \ + asonix/pictrs:arm64v8-$new_tag \ + asonix/pictrs:arm32v7-$new_tag \ + asonix/pictrs:amd64-$new_tag + +annotate $new_tag arm64v8 +annotate $new_tag arm32v7 +annotate $new_tag amd64 + +# docker manifest push asonix/pictrs:$new_tag