shin / docker-entrypoint.sh
shinmentakezo07
fix: bind HF Spaces exposed port in docker image
78f4f56
Raw
History Blame Contribute Delete
775 Bytes
#!/bin/sh
set -e
# FCC's Settings read the PORT env var directly (image default 7860 for HF
# Spaces, overridable per deployment). Log the effective bind port so the
# server log confirms the expected address.
if [ -n "${PORT:-}" ]; then
echo "fcc: using PORT=${PORT}" >&2
export PORT
fi
# Seed a writable managed env file so the Admin UI has a starting point.
# A bind-mounted host ./.env or a named volume at /app/.env is preserved;
# anything else (for example an empty directory Docker auto-created for a
# missing bind source) is replaced with the bundled example.
if [ ! -f /app/.env ]; then
if [ -e /app/.env ]; then
echo "warning: /app/.env is not a regular file; replacing it" >&2
rm -rf /app/.env
fi
cp /app/.env.example /app/.env
fi
exec "$@"