addet buildscript
This commit is contained in:
parent
84177af684
commit
b13938b773
1 changed files with 31 additions and 0 deletions
31
src/build.sh
Executable file
31
src/build.sh
Executable 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
|
Loading…
Add table
Add a link
Reference in a new issue