made example deployments for different environments
This commit is contained in:
@@ -0,0 +1,60 @@
|
|||||||
|
services:
|
||||||
|
app:
|
||||||
|
build:
|
||||||
|
context: .
|
||||||
|
dockerfile: Dockerfile
|
||||||
|
ports:
|
||||||
|
- "8000:8000"
|
||||||
|
volumes:
|
||||||
|
# Persist database to local directory
|
||||||
|
- ./data:/data
|
||||||
|
environment:
|
||||||
|
# Set environment to production
|
||||||
|
- ENVIRONMENT=production
|
||||||
|
# Set admin credentials
|
||||||
|
- ADMIN_USERNAME=admin
|
||||||
|
- ADMIN_PASSWORD=password
|
||||||
|
# Use Redis for token storage
|
||||||
|
- REDIS_URI=redis://redis:6379/0
|
||||||
|
# Use PostgreSQL for database
|
||||||
|
- DATABASE_URL=postgresql://baby_monitor:securepassword@postgres:5432/b
|
||||||
|
command: ["--host", "0.0.0.0", "--port", "8000"]
|
||||||
|
restart: unless-stopped
|
||||||
|
depends_on:
|
||||||
|
redis:
|
||||||
|
condition: service_healthy
|
||||||
|
postgres:
|
||||||
|
condition: service_healthy
|
||||||
|
redis:
|
||||||
|
image: redis:7-alpine
|
||||||
|
ports:
|
||||||
|
- "6379:6379"
|
||||||
|
volumes:
|
||||||
|
- redis-data:/data
|
||||||
|
restart: unless-stopped
|
||||||
|
healthcheck:
|
||||||
|
test: ["CMD", "redis-cli", "ping"]
|
||||||
|
interval: 10s
|
||||||
|
timeout: 5s
|
||||||
|
retries: 5
|
||||||
|
start_period: 1s
|
||||||
|
postgres:
|
||||||
|
image: postgres:14-alpine
|
||||||
|
environment:
|
||||||
|
- POSTGRES_USER=baby_monitor
|
||||||
|
- POSTGRES_PASSWORD=securepassword
|
||||||
|
- POSTGRES_DB=baby_monitor_db
|
||||||
|
ports:
|
||||||
|
- "5432:5432"
|
||||||
|
volumes:
|
||||||
|
- pgdata:/var/lib/postgresql/data
|
||||||
|
restart: unless-stopped
|
||||||
|
healthcheck:
|
||||||
|
test: ["CMD-SHELL", "pg_isready -U baby_monitor -d baby_monitor_db"]
|
||||||
|
interval: 10s
|
||||||
|
timeout: 5s
|
||||||
|
retries: 5
|
||||||
|
start_period: 10s
|
||||||
|
volumes:
|
||||||
|
redis-data:
|
||||||
|
pgdata:
|
||||||
@@ -16,19 +16,5 @@ services:
|
|||||||
# Optional: Override admin credentials for development
|
# Optional: Override admin credentials for development
|
||||||
- ADMIN_USERNAME=admin
|
- ADMIN_USERNAME=admin
|
||||||
- ADMIN_PASSWORD=password
|
- ADMIN_PASSWORD=password
|
||||||
# Optional: Use Redis for token storage (uncomment redis service below)
|
|
||||||
# - REDIS_URI=redis://redis:6379/0
|
|
||||||
command: ["--host", "0.0.0.0", "--port", "8000", "--reload"]
|
command: ["--host", "0.0.0.0", "--port", "8000", "--reload"]
|
||||||
restart: unless-stopped
|
restart: unless-stopped
|
||||||
|
|
||||||
# Uncomment to enable Redis token storage
|
|
||||||
# redis:
|
|
||||||
# image: redis:7-alpine
|
|
||||||
# ports:
|
|
||||||
# - "6379:6379"
|
|
||||||
# volumes:
|
|
||||||
# - redis-data:/data
|
|
||||||
# restart: unless-stopped
|
|
||||||
# Uncomment if using Redis
|
|
||||||
# volumes:
|
|
||||||
# redis-data:
|
|
||||||
|
|||||||
Reference in New Issue
Block a user