diff --git a/docker/build-image.sh b/docker/build-image.sh new file mode 100755 index 00000000..0f4c015d --- /dev/null +++ b/docker/build-image.sh @@ -0,0 +1,21 @@ +#!/bin/bash + +set -eux + +build () { + if [ "${ARCH}" = "amd64" ]; then + docker build . -t "ghcr.io/alphagov/${APP}:${1}" -f "Dockerfile" + else + docker buildx build --platform "linux/${ARCH}" . -t "ghcr.io/alphagov/${APP}:${1}" -f "Dockerfile" + fi +} + +DOCKER_TAG="${GITHUB_SHA}" + +build "${DOCKER_TAG}" + +if [[ -n ${DRY_RUN:-} ]]; then + echo "Dry run; not pushing to registry" +else + docker push "ghcr.io/alphagov/${APP}:${DOCKER_TAG}" +fi