diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 3a25b8bbf..0943e25fb 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -23,4 +23,4 @@ jobs: distribution: 'temurin' cache: 'sbt' - name: Build and push images - run: bash docker-action.sh + run: bash build/docker-action.sh diff --git a/README.md b/README.md index 769d5ab8c..2ed7c3948 100644 --- a/README.md +++ b/README.md @@ -36,7 +36,6 @@ You have to ensure that you local environment has the following: docker run -d -i --name unitycatalog -p 8081:8081 datacatering/unitycatalog:0.1.0 ``` - In a terminal, in the cloned repository root directory, start the UC server. ``` diff --git a/docker-action.sh b/build/docker-action.sh similarity index 65% rename from docker-action.sh rename to build/docker-action.sh index 5bdbb00e9..538d4646f 100644 --- a/docker-action.sh +++ b/build/docker-action.sh @@ -1,10 +1,14 @@ #!/bin/bash +#Script to help create server and cli jar files via SBT. Then to build and push as Docker image. + +SCRIPT_DIR="$(dirname "$(readlink -f "$0")")" +ROOT_DIR="$(dirname "$SCRIPT_DIR")" APP_VERSION=$(awk -F ' := ' '{print $2}' version.sbt | tr -d '"') PLATFORMS="linux/amd64,linux/arm64" run_sbt() { - SBT_COMMAND="./build/sbt -J-Xms4G -J-Xmx4G -info clean assembly" + SBT_COMMAND="$ROOT_DIR/build/sbt -J-Xms4G -J-Xmx4G -info clean assembly" echo "Running SBT to generate Server and CLI JAR: $SBT_COMMAND" $SBT_COMMAND || exit } @@ -23,10 +27,12 @@ if [ -z "$CLI_JAR" ]; then run_sbt fi +echo "Setting up docker for multi-platform builds using buildx" docker run --privileged --rm tonistiigi/binfmt --install all docker buildx create --use --name builder docker buildx inspect --bootstrap builder -docker buildx build \ +echo "Running Docker build command, version=$APP_VERSION, platforms=$PLATFORMS" +(cd "$ROOT_DIR/.."; docker buildx build \ --platform "$PLATFORMS" \ - -t datacatering/unitycatalog:"$APP_VERSION" --push . + -t datacatering/unitycatalog:"$APP_VERSION" --push .)