addet buildscript

This commit is contained in:
pika 2025-03-10 19:24:25 +01:00
parent 84177af684
commit b13938b773

31
src/build.sh Executable file
View file

@ -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