diff --git a/src/build.sh b/src/build.sh new file mode 100755 index 0000000..30d49a6 --- /dev/null +++ b/src/build.sh @@ -0,0 +1,31 @@ +#!/usr/bin/env bash +# ─< ANSI color codes >─────────────────────────────────────────────────────────────────── +RED='\033[0;31m' +CYAN='\033[0;36m' +NC='\033[0m' # No Color + +echo_error() { + printf "${BOLD}${RED}ERROR: ${NC}${RED}%s${NC}\n" "$1" >&2 +} + +echo_info() { + printf "${BOLD}${CYAN}INFO: ${NC}${CYAN}%s${NC}\n" "$1" +} + +# ─< Check if the given command exists silently >───────────────────────────────────────── +command_exists() { + command -v "$@" >/dev/null 2>&1 +} + +image="caddydb" +tag="latest" + +if command_exists docker; then + if [ -e ./Dockerfile ]; then + docker build -t "${image}:${tag}" . + else + echo_error "There was no dockerfile present in this directory: $PWD" + fi +else + echo_error "Docker is not installed!" +fi