gohttpserver/bin/entrypoint-gohttpserver.sh
casjay 7a986369ca
🗃️ Updated domain names 🗃️
bin/entrypoint-gohttpserver.sh
Dockerfile
LICENSE.md
rootfs/usr/local/bin/entrypoint.sh
rootfs/usr/local/bin/start-gohttpserver.sh
2023-08-10 19:55:10 -04:00

76 lines
2.2 KiB
Bash

#!/usr/bin/env bash
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
##@Version : 202202020147-git
# @Author : Jason Hempstead
# @Contact : jason@casjaysdev.pro
# @License : WTFPL
# @ReadME : docker-entrypoint --help
# @Copyright : Copyright: (c) 2022 Jason Hempstead, Casjays Developments
# @Created : Wednesday, Feb 02, 2022 01:47 EST
# @File : docker-entrypoint
# @Description :
# @TODO :
# @Other :
# @Resource :
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
# Set bash options
[ -n "$DEBUG" ] && set -x
set -o pipefail
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
APPNAME="$(basename "$0")"
VERSION="202202020147-git"
USER="${SUDO_USER:-${USER}}"
HOME="${USER_HOME:-${HOME}}"
SRC_DIR="${BASH_SOURCE%/*}"
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
HOSTADMIN="${HOSTADMIN:-admin@localhost}"
SSL="${SSL:-}"
export TZ="${TZ:-America/New_York}"
export HOSTNAME="${HOSTNAME:-casjaysdev-gohttpserver}"
[ -n "${TZ}" ] && echo "${TZ}" >/etc/timezone
[ -n "${HOSTNAME}" ] && echo "${HOSTNAME}" >/etc/hostname
[ -n "${HOSTNAME}" ] && echo "127.0.0.1 $HOSTNAME localhost" >/etc/hosts
[ -f "/usr/share/zoneinfo/${TZ}" ] && ln -sf "/usr/share/zoneinfo/${TZ}" "/etc/localtime"
if [ -f "/config/ssl/server.crt" ] && [ -f "/config/ssl/server.key" ]; then
SSL="on"
SSL_CERT="/config/ssl/server.crt"
SSL_KEY="/config/ssl/server.key"
if [ -f "/config/ssl/ca.crt" ]; then
cat "/config/ssl/ca.crt" >>"/etc/ssl/certs/ca-certificates.crt"
fi
elif [ "$SSL" = "on" ]; then
create-ssl-cert "/config/ssl"
fi
update-ca-certificates
if [ "$SSL" = on ] && [ -z "$CONFIG" ]; then
CONFIG="--cert=$SSL_CERT --key=$SSL_KEY"
else
CONFIG=""
fi
case "$1" in
healthcheck)
if curl -q -LSsf -o /dev/null -s -w "200" "http://localhost/server-health"; then
echo "OK"
exit 0
else
echo "FAIL"
exit 10
fi
;;
bash | shell | sh)
shift 1
ARGS="$*"
exec /bin/bash ${ARGS:--l}
;;
*)
exec gohttpserver --title=DevSystem --cors --xheaders --theme=black --addr=0.0.0.0 --port=${PORT:-19065} --root=/data/htdocs/www $CONFIG
;;
esac