#!/bin/bash push=false # Process oprions while getopts "pt:" opt; do case $opt in p) push=true;; t) tag=$OPTARG;; \?) echo "Invalid option: -$OPTARG" >&2 ;; :) echo "Option -$OPTARG requires an argument." >&2 ;; esac done docker build -t nexus.springblast.de:8082/carly/docker-stm32/cubeclt:$tag . docker build -t nexus.springblast.de:8082/carly/docker-stm32/cubeclt:latest . if [ "$push" = true ]; then docker push nexus.springblast.de:8082/carly/docker-stm32/cubeclt:$tag docker push nexus.springblast.de:8082/carly/docker-stm32/cubeclt:latest fi