Spaces:
Running
Running
Upload 629 files
Browse files- Dockerfile +1 -1
- README.md +6 -5
Dockerfile
CHANGED
|
@@ -6,7 +6,7 @@ ENV PYTHONDONTWRITEBYTECODE=1 \
|
|
| 6 |
PIP_DISABLE_PIP_VERSION_CHECK=1 \
|
| 7 |
HF_HOME=/home/user/.cache/huggingface \
|
| 8 |
APP_NAME=MediaRouter \
|
| 9 |
-
APP_ENVIRONMENT=
|
| 10 |
TEMP_DIR=/app/temp \
|
| 11 |
OUTPUT_DIR=/app/outputs \
|
| 12 |
PORT=7860
|
|
|
|
| 6 |
PIP_DISABLE_PIP_VERSION_CHECK=1 \
|
| 7 |
HF_HOME=/home/user/.cache/huggingface \
|
| 8 |
APP_NAME=MediaRouter \
|
| 9 |
+
APP_ENVIRONMENT=development \
|
| 10 |
TEMP_DIR=/app/temp \
|
| 11 |
OUTPUT_DIR=/app/outputs \
|
| 12 |
PORT=7860
|
README.md
CHANGED
|
@@ -124,17 +124,18 @@ docker run --rm -p 7860:7860 --env-file .env media-api
|
|
| 124 |
|
| 125 |
The image uses `python:3.10-slim`, installs FFmpeg, FFprobe, ImageMagick and the system libraries needed by CTranslate2/faster-whisper, clears apt and pip caches, runs as UID 1000, exposes port 7860, and includes a container health check.
|
| 126 |
|
| 127 |
-
The Docker image
|
| 128 |
-
|
| 129 |
-
|
| 130 |
-
|
|
|
|
| 131 |
|
| 132 |
## Deploy to Hugging Face Spaces
|
| 133 |
|
| 134 |
1. Create a new Space and select **Docker** as the SDK.
|
| 135 |
2. Push the contents of this directory to the Space repository. Keep the YAML block at the top of this README; `app_port` is already `7860`.
|
| 136 |
3. Apply the PostgreSQL migrations in the documented dependency order, using a controlled administrative connection.
|
| 137 |
-
4.
|
| 138 |
5. Generate the initial administrator key locally with `python -m app.security.cli generate-bootstrap --environment live`. Store `API_KEY` in a password manager. Add only the printed `AUTH_BOOTSTRAP_KEY_HASH`, `AUTH_BOOTSTRAP_KEY_PREFIX`, and `AUTH_BOOTSTRAP_ENVIRONMENT` under **Settings → Secrets**. Do not commit them.
|
| 139 |
6. Wait for the Docker build. The first Whisper call downloads the selected model to the Hugging Face cache. Persistent storage is optional for the model cache, but avoids downloading models again after a cold rebuild.
|
| 140 |
7. Check the public `https://<owner>-<space>.hf.space/health`, then run `scripts/deployment_smoke.py` against the Space before accepting traffic.
|
|
|
|
| 124 |
|
| 125 |
The image uses `python:3.10-slim`, installs FFmpeg, FFprobe, ImageMagick and the system libraries needed by CTranslate2/faster-whisper, clears apt and pip caches, runs as UID 1000, exposes port 7860, and includes a container health check.
|
| 126 |
|
| 127 |
+
The Docker image defaults to `APP_ENVIRONMENT=development` so it can start
|
| 128 |
+
without external PostgreSQL or a Vercel CORS origin. For production, set
|
| 129 |
+
`APP_ENVIRONMENT=production` and configure external PostgreSQL/Supabase,
|
| 130 |
+
apply the explicit migrations, exact CORS origins, and the required
|
| 131 |
+
RLS/worker roles before startup. See [the production deployment gate](docs/production-deployment-gate.md).
|
| 132 |
|
| 133 |
## Deploy to Hugging Face Spaces
|
| 134 |
|
| 135 |
1. Create a new Space and select **Docker** as the SDK.
|
| 136 |
2. Push the contents of this directory to the Space repository. Keep the YAML block at the top of this README; `app_port` is already `7860`.
|
| 137 |
3. Apply the PostgreSQL migrations in the documented dependency order, using a controlled administrative connection.
|
| 138 |
+
4. For a quick start, the Space can run with the default `development` environment and local SQLite storage. For production, configure the required PostgreSQL/RLS/CORS variables and roles in Space Settings and set `APP_ENVIRONMENT=production`. Keep `SECURITY_AUTO_MIGRATE=false` and `SOCIAL_AUTO_MIGRATE=false`.
|
| 139 |
5. Generate the initial administrator key locally with `python -m app.security.cli generate-bootstrap --environment live`. Store `API_KEY` in a password manager. Add only the printed `AUTH_BOOTSTRAP_KEY_HASH`, `AUTH_BOOTSTRAP_KEY_PREFIX`, and `AUTH_BOOTSTRAP_ENVIRONMENT` under **Settings → Secrets**. Do not commit them.
|
| 140 |
6. Wait for the Docker build. The first Whisper call downloads the selected model to the Hugging Face cache. Persistent storage is optional for the model cache, but avoids downloading models again after a cold rebuild.
|
| 141 |
7. Check the public `https://<owner>-<space>.hf.space/health`, then run `scripts/deployment_smoke.py` against the Space before accepting traffic.
|