Skip to content

Instantly share code, notes, and snippets.

@raykipkorir
Created January 16, 2024 07:46
Show Gist options
  • Save raykipkorir/02ab7b50922a02d54928e06182397755 to your computer and use it in GitHub Desktop.
Save raykipkorir/02ab7b50922a02d54928e06182397755 to your computer and use it in GitHub Desktop.
Docker compose file - for production
version: "3.8"
services:
app:
build:
context: .
dockerfile: ./compose/production/django/Dockerfile
command: ["sh", "-c", "/start-app.sh"]
image: django_prod
container_name: django_prod
volumes:
- static-data:/vol/static
- media-data:/vol/media
env_file:
- .env
depends_on:
- postgres_prod_db
postgres_prod_db:
image: postgres:15
container_name: django_prod_postgres
environment:
POSTGRES_USER: ${SQL_USER}
POSTGRES_PASSWORD: ${SQL_PASSWORD}
POSTGRES_DB: ${SQL_DATABASE}
volumes:
- postgres_prod_data:/var/lib/postgresql/data
nginx_proxy:
build:
context: ./compose/production/nginx
command: ["sh", "-c", "/start-nginx.sh"]
ports:
- "80:80"
volumes:
- static-data:/vol/static
- media-data:/vol/media
depends_on:
- app
volumes:
postgres_prod_data:
static-data:
media-data:
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment