Render Docker Deployment
Overview
Safegloss is deployed on Render using a Docker-based build. Docker caching and a slim base image help keep deploy times fast.
Build
- Base image: pinned Python version (e.g., 3.12.x slim)
- Install dependencies from requirements.txt
- Copy application source after dependencies to preserve cache
Required Env Vars (examples)
- DATABASE_URL
- REDIS_URL
- DJANGO_SECRET_KEY
- ALLOWED_HOSTS
- OPENROUTER_API_KEY (if configured)
- OPENAI_API_KEY (if required for TTS)
Static Files
- Collect static via a release step or optional runtime hook.
- Avoid running collectstatic in Docker build if it changes frequently.
Migrations
- Run migrations in a release or one-off job.
- Do not run migrations in the Dockerfile.
Rollback
- Render provides deploy rollback to previous images.
- Keep database migrations backward compatible when possible.