Skip to content

Instantly share code, notes, and snippets.

@pramod-io
Created October 20, 2025 15:34
Show Gist options
  • Select an option

  • Save pramod-io/ce302e8194c796e57548303b5d8e136a to your computer and use it in GitHub Desktop.

Select an option

Save pramod-io/ce302e8194c796e57548303b5d8e136a to your computer and use it in GitHub Desktop.
Docker Compose example
services:
db:
image: postgres:16.8
container_name: ds_postgres
restart: unless-stopped
volumes:
- pgdata:/var/lib/postgresql/data
ports:
- "5432:5432"
environment:
- POSTGRES_DB=ds_dev
- POSTGRES_USER=ds_dev_user
- POSTGRES_PASSWORD=abcd
healthcheck:
test: [ "CMD-SHELL", "pg_isready -U ds_dev_user -d ds_dev" ]
interval: 10s
timeout: 5s
retries: 5
networks:
- app_network
redis:
image: redis:8.0.0
container_name: ds_redis
restart: unless-stopped
ports:
- "6379:6379"
volumes:
- redis_data:/data
healthcheck:
test: [ "CMD", "redis-cli", "ping" ]
interval: 10s
timeout: 5s
retries: 5
networks:
- app_network
scraper:
build:
context: ./scraper
dockerfile: Dockerfile
container_name: ds_scraper
restart: unless-stopped
command: node server.js
volumes:
- ./scraper:/app
- /app/node_modules
ports:
- "3000:3000"
environment:
- NODE_ENV=development
healthcheck:
test: [ "CMD", "curl", "-f", "http://localhost:3000/healthcheck" ]
interval: 10s
timeout: 5s
retries: 5
networks:
- app_network
db_migration:
build:
context: ./ds
dockerfile: Dockerfile
container_name: ds_db_migration
command: uv run manage.py migrate
volumes:
- ./ds:/app
env_file:
- ./ds/.env.dev
depends_on:
db:
condition: service_healthy
networks:
- app_network
schedule_periodic_tasks:
build:
context: ./ds
dockerfile: Dockerfile
container_name: ds_schedule_periodic_tasks
command: uv run manage.py schedule_periodic_tasks
volumes:
- ./ds:/app
env_file:
- ./ds/.env.dev
depends_on:
db_migration:
condition: service_completed_successfully
networks:
- app_network
celery_worker:
build:
context: ./ds
dockerfile: Dockerfile
container_name: ds_celery_worker
restart: unless-stopped
command: uv run celery -A ds worker --loglevel=info
volumes:
- ./ds:/app
env_file:
- ./ds/.env.dev
depends_on:
db:
condition: service_healthy
schedule_periodic_tasks:
condition: service_completed_successfully
redis:
condition: service_healthy
scraper:
condition: service_healthy
networks:
- app_network
celery_beat:
build:
context: ./ds
dockerfile: Dockerfile
container_name: ds_celery_beat
restart: unless-stopped
command: uv run celery -A ds beat --loglevel=info
volumes:
- ./ds:/app
env_file:
- ./ds/.env.dev
depends_on:
db:
condition: service_healthy
schedule_periodic_tasks:
condition: service_completed_successfully
redis:
condition: service_healthy
networks:
- app_network
celery_flower:
build:
context: ./ds
dockerfile: Dockerfile
container_name: ds_celery_flower
restart: unless-stopped
command: uv run celery -A ds flower --port=5555
volumes:
- ./ds:/app
ports:
- "5555:5555"
env_file:
- ./ds/.env.dev
depends_on:
db:
condition: service_healthy
schedule_periodic_tasks:
condition: service_completed_successfully
redis:
condition: service_healthy
networks:
- app_network
django_api:
build:
context: ./ds
dockerfile: Dockerfile
container_name: ds_django_api
restart: unless-stopped
command: uv run debugpy --listen 0.0.0.0:5678 manage.py runserver 0.0.0.0:8000
volumes:
- ./ds:/app
ports:
- "8000:8000"
- "5678:5678"
env_file:
- ./ds/.env.dev
depends_on:
db:
condition: service_healthy
schedule_periodic_tasks:
condition: service_completed_successfully
redis:
condition: service_healthy
scraper:
condition: service_healthy
celery_worker:
condition: service_started
celery_beat:
condition: service_started
networks:
- app_network
marimo:
build:
context: ./ds
dockerfile: Dockerfile
container_name: ds_marimo
restart: unless-stopped
command: uv run marimo edit --host 0.0.0.0 --token --token-password="abcd"
volumes:
- ./ds:/app
ports:
- "2718:2718"
env_file:
- ./ds/.env.dev
depends_on:
db:
condition: service_healthy
schedule_periodic_tasks:
condition: service_completed_successfully
redis:
condition: service_healthy
scraper:
condition: service_healthy
celery_worker:
condition: service_started
celery_beat:
condition: service_started
networks:
- app_network
frontend:
build:
context: ./frontend
dockerfile: Dockerfile
container_name: ds_frontend
restart: unless-stopped
command: npm run dev -- --host 0.0.0.0
volumes:
- ./frontend:/app
- /app/node_modules
ports:
- "5173:5173"
environment:
- NODE_ENV=development
networks:
- app_network
nginx:
image: nginx:stable-alpine
container_name: ds_nginx
restart: unless-stopped
ports:
- "7777:7777"
volumes:
- ./nginx/nginx.dev.conf:/etc/nginx/nginx.conf
depends_on:
- django_api
- frontend
networks:
- app_network
volumes:
pgdata:
redis_data:
networks:
app_network:
driver: bridge
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment