gitea-pages-server/.dockerfiles/entrypoint.sh
2023-08-20 00:44:34 +10:00

33 lines
587 B
Bash
Executable File

#!/bin/sh
set -e
if [ "$(id -u)" -eq 0 ]; then
[ -n "${PUID}" ] && usermod -u "${PUID}" nobody
[ -n "${PGID}" ] && groupmod -g "${PGID}" nobody
fi
printf "Configuring application...\n"
cat > /Caddyfile <<EOF
{
debug
auto_https off
order gitea before file_server
persist_config off
}
:8000
bind 0.0.0.0
gitea {
server ${GITEA_URL:?not set}
token ${GITEA_TOKEN:?not set}
domain ${DOMAIN:?not set}
}
EOF
if [ "$(id -u)" -eq 0 ]; then
printf "Switching UID=%s and GID=%s\n" "$(id -u nobody)" "$(id -g nobody)"
exec su-exec nobody:nobody "$@"
else
exec "$@"
fi