From 5e09fadc3b749db22b74404bbaed411c7508512e Mon Sep 17 00:00:00 2001 From: asonix Date: Sun, 22 Mar 2020 16:32:42 -0500 Subject: [PATCH] Optionally build migrations --- build.sh | 32 ++++++++++++++++++++------------ 1 file changed, 20 insertions(+), 12 deletions(-) diff --git a/build.sh b/build.sh index 9db2e56..60af8e6 100755 --- a/build.sh +++ b/build.sh @@ -2,6 +2,7 @@ BUILD_DATE=$(date) VERSION=$1 +MIGRATIONS=$2 function require() { if [ "$1" = "" ]; then @@ -15,10 +16,11 @@ function print_help() { echo "build.sh" echo "" echo "Usage:" - echo " build.sh [version]" + echo " build.sh [version] [migrations]" echo "" echo "Args:" echo " version: The version of the current container" + echo " migrations: (optional) Whether to build the migrations container as well" } require "$VERSION" "version" @@ -46,17 +48,23 @@ docker build \ -t "asonix/relay:latest" \ ./artifacts -docker build \ - --pull \ - --no-cache \ - --build-arg BUILD_DATE="${BUILD_DATE}" \ - --build-arg TAG="${TAG}" \ - -f Dockerfile.migrations.arm64v8 \ - -t "asonix/relay-migrations:${VERSION}-arm64v8" \ - -t "asonix/relay-migrations:latest-arm64v8" \ - -t "asonix/relay-migrations:latest" \ - ./artifacts - docker push "asonix/relay:${VERSION}-arm64v8" docker push "asonix/relay:latest-arm64v8" docker push "asonix/relay:latest" + +if [ "${MIGRATIONS}" = "" ]; then + docker build \ + --pull \ + --no-cache \ + --build-arg BUILD_DATE="${BUILD_DATE}" \ + --build-arg TAG="${TAG}" \ + -f Dockerfile.migrations.arm64v8 \ + -t "asonix/relay-migrations:${VERSION}-arm64v8" \ + -t "asonix/relay-migrations:latest-arm64v8" \ + -t "asonix/relay-migrations:latest" \ + ./artifacts + + docker push "asonix/relay-migrations:${VERSION}-arm64v8" + docker push "asonix/relay-migrations:latest-arm64v8" + docker push "asonix/relay-migrations:latest" +fi