From f27605434b404406ed9d6f09507dd39d764101b5 Mon Sep 17 00:00:00 2001 From: Jenny Danzmayr Date: Fri, 8 Dec 2023 00:22:49 +0100 Subject: [PATCH] updated docker build script to allow building from git --- docker/build.sh | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/docker/build.sh b/docker/build.sh index e1651eac..717b8124 100755 --- a/docker/build.sh +++ b/docker/build.sh @@ -4,6 +4,13 @@ set -e PROJDIR="$(dirname "$(dirname "$(readlink -f "$0")")")" cd "$PROJDIR" COMMIT="$(git rev-parse HEAD)" +CONTEXT="." + +if [[ "$1" == "git" ]]; then + git fetch origin + COMMIT="$(git rev-parse origin/main)" + CONTEXT="https://github.com/c3nav/c3nav.git#${COMMIT}" +fi docker buildx build -f docker/Dockerfile \ --platform linux/arm64,linux/amd64 \ @@ -15,7 +22,7 @@ docker buildx build -f docker/Dockerfile \ --annotation org.opencontainers.image.description="Indoor navigation for the Chaos Communication Congress and other events. - Core" \ --cache-from "type=registry,ref=ghcr.io/c3nav/c3nav_cache:main" \ --cache-to "type=registry,ref=ghcr.io/c3nav/c3nav_cache:main,mode=max" \ - --push . + --push "${CONTEXT}" docker buildx build -f docker/tileserver.dockerfile \ --platform linux/arm64,linux/amd64 \ @@ -27,4 +34,4 @@ docker buildx build -f docker/tileserver.dockerfile \ --annotation org.opencontainers.image.description="Indoor navigation for the Chaos Communication Congress and other events. - Tileserver" \ --cache-from "type=registry,ref=ghcr.io/c3nav/c3nav_cache:tileserver_main" \ --cache-to "type=registry,ref=ghcr.io/c3nav/c3nav_cache:tileserver_main,mode=max" \ - --push . + --push "${CONTEXT}"