Ensure you have the following installed on your system:
- Docker
- Docker Compose v2.24+
- GNU Make (optional but recommended)
This project uses a .env file for environment-specific settings like development or production mode on docker.
# Set the environment mode
ENVIRONMENT=developmentENVIRONMENT=development: Runs the server in development mode with auto-reload and debug logs.- Change to
ENVIRONMENT=productionto enable multi-worker production mode with detached execution (make up).
Tip: If this variable is not set, the default is automatically assumed to be
development.
Use
makecommands for simplified usage.
make build # Regular build
make build-fresh # Force clean build (no cache)make upDepending on the environment:
- In development, the server runs in the foreground with hot-reloading.
- In production, the server runs in detached mode (
-d) with multiple workers.
make stop- Reloading: In development, the server uses
uvicorn --reloadfor live updates. - Logging: On container start, it prints the current environment with colors (🟡 dev / ⚪ production).
- Watch Mode (optional): Docker Compose v2.24+ supports file watching via the
compose watchfeature. If enabled, presswto toggle.
Key files:
.
├── Dockerfile # Base image and command logic
├── docker-compose.yml # Shared config (network, ports, env)
├── .env # Defines ENVIRONMENT (development/production)
├── Makefile # Simplifies Docker CLI usage
- Don't use
ENVIRONMENT=developmentin production. - Avoid bind mounts (
volumes) in production to ensure image consistency.