#!/bin/bash set -e usage="$(basename "$0") [-h] [-t RELEASE_VERSION ] The script compiles Caddy server with GiteaPages plugin, and publishes the resulting image to the https://hub.docker.com/u/djmil Where: -t RELEASE_VERSION A major.minor.patch tag for the image being publisdhed. " tag='' while getopts ht: flag do case "${flag}" in t) tag=${OPTARG};; h) echo "$usage"; exit 0;; *) echo "$usage" >&2; exit 1;; esac done if [ ! "$tag" ]; then echo 'Missing: -t RELEASE_VERSION' >&2 exit 1 fi echo "Tag: $tag"; docker build --tag djmil/gitea-pages:$tag . #git tag #git push tag docker login --username djmil #--password-stdin docker push djmil/gitea-pages:$tag