-
Jonas Braathen authored
Add a Containerfile for the frontend. Allow configuration to be injected. Move static files directory for Django.
Jonas Braathen authoredAdd a Containerfile for the frontend. Allow configuration to be injected. Move static files directory for Django.
#!/bin/sh
set -ex
GIT_BRANCH=`git rev-parse --abbrev-ref HEAD`
GIT_SHA=`git rev-parse --short HEAD`
REPO="harbor.uio.no"
PROJECT="it-usit-int-drift"
APP_NAME="greg-frontend"
CONTAINER="${REPO}/${PROJECT}/${APP_NAME}"
IMAGE_TAG="${CONTAINER}:${GIT_BRANCH}-${GIT_SHA}"
if command -v podman > /dev/null 2>&1; then
BUILDER=$(command -v podman)
else
echo "Missing podman CLI tools"
exit 1
fi
echo "Will build using $BUILDER"
echo "Building $IMAGE_TAG"
$BUILDER build --format docker --no-cache -t $IMAGE_TAG .
echo "Pushing $IMAGE_TAG"
$BUILDER push $IMAGE_TAG
if [ $GIT_BRANCH = "master" ]; then
echo "On master branch, setting $IMAGE_TAG as $CONTAINER:latest"
$BUILDER tag $IMAGE_TAG $CONTAINER:latest
$BUILDER push $CONTAINER:latest
fi