Download docker-entrypoint.sh from jun2024/fc: direct link, hf CLI and curl.
- Browser
- Download file 1.06 kB
-
https://huggingface.co/spaces/jun2024/fc/resolve/main/docker-entrypoint.sh
- Command line
-
hf download hf://spaces/jun2024/fc/docker-entrypoint.sh
-
curl -L -o docker-entrypoint.sh https://huggingface.co/spaces/jun2024/fc/resolve/main/docker-entrypoint.sh
1.06 kB
| set -e | |
| cd /app/apiSystem | |
| if [ "${DB_ENGINE:-postgresql}" = "postgres" ] || [ "${DB_ENGINE:-postgresql}" = "postgresql" ] || [ "${DB_ENGINE:-postgresql}" = "django.db.backends.postgresql" ]; then | |
| echo "Waiting for PostgreSQL..." | |
| uv run python - <<'PY' | |
| import os | |
| import time | |
| import psycopg | |
| host = os.environ.get("DB_HOST", "postgres") | |
| port = int(os.environ.get("DB_PORT", "5432")) | |
| name = os.environ.get("DB_NAME", "fachuan_dev") | |
| user = os.environ.get("DB_USER", "postgres") | |
| password = os.environ.get("DB_PASSWORD", "postgres") | |
| deadline = time.time() + 60 | |
| while True: | |
| try: | |
| with psycopg.connect(host=host, port=port, dbname=name, user=user, password=password, connect_timeout=5): | |
| break | |
| except Exception: | |
| if time.time() >= deadline: | |
| raise | |
| time.sleep(2) | |
| PY | |
| fi | |
| echo "Running migrations..." | |
| uv run python manage.py migrate --noinput | |
| echo "Collecting static files..." | |
| uv run python manage.py collectstatic --noinput | |
| echo "Starting server..." | |
| exec uv run python manage.py runserver 0.0.0.0:8002 | |