Skip to content

Commit

Permalink
Add build-image.sh
Browse files Browse the repository at this point in the history
  • Loading branch information
kentsanggds committed Nov 10, 2023
1 parent 51314e5 commit a2d242e
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions docker/build-image.sh
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit a2d242e

Please sign in to comment.