--- /dev/null
+#!/usr/bin/bash
+# build the image and push to container registry
+
+# helpers
+
+section="" ## Formatted as <verb> <noun>
+function echoSection() {
+ if [ -z "$1" ] ; then
+ echo""
+ echo "--- $0: $section ---"
+ else
+ echo "--- $0: $section $1 ---"
+ fi
+}
+
+## intro
+section="Printing Info"
+echoSection ""
+echo "Deploying yampl, a toml to html site generator."
+echo "commit id: $(git rev-list --max-count=1 HEAD)"
+echo "go version: $(go version)"
+echo "podman version: $(podman --version)"
+echo "buildah version: $(buildah --version)"
+
+echoSection "end"
+
+
+## check codebase
+section="Checking Codebase"
+echoSection ""
+
+set -x
+fmtout=$(go run cmd/gofmt -e -l -d .)
+set +x
+# TODO go fix
+# TODO go vet
+# TODO golangcli lint
+if [ -n "$fmtout" ] ; then
+ echo "$fmtout"
+ echoSection "failure"
+ exit -1
+fi
+
+echoSection "success"
+
+## build Containerfile
+section="Building Containerfile"
+echoSection ""
+
+image="localhost/yampl"
+
+buildah build -f Containerfile -t $image
+if [ $? -eq 0 ] ; then
+ echoSection "success"
+else
+ echoSection "failure"
+ exit -2
+fi
+
+## push container to the registry
+section="push image"
+echoSection ""
+
+if [ -z "$CONTAINER_REGISTRY_USERNAME$CONTAINER_REGISTRY_PASSWORD"] ; then
+ echoSection "skip"
+else
+ gitbranch="git rev-pars --abrev-ref HEAD"
+
+ newimage="containers.openfl.eu/local/yampl:$gitbranch"
+ podman tag $image $newimage
+ image=$newimage
+ podman login --username $CONTAINER_REGISTRY_USERNAME --password $CONTAINER_REGISTRY_PASSWORD containers.openfl.eu
+ podman push "containers.openfl.eu/local/yampl:$gitbranch"
+ if [ $? -ne 0 ] ; then
+ echoSection "failure"
+ exit -3
+ fi
+fi
+
+echoSection "success"
+
+## update the content of the volumes
+section="update data"
+echoSection ""
+echoSection "success"
+
+## restart the service
+section="restart container"
+echoSection ""
+podman compose pull && \
+podman compose down && \
+podman compose up -d
+if [ $? -ne 0 ] ; then
+ echoSection "failure"
+ exit -4
+fi
+echoSection "success"