Skip to content

Instantly share code, notes, and snippets.

@AliYmn
Last active December 14, 2020 06:39
Show Gist options
  • Save AliYmn/ce4e3075090a05753d9df328a0155fe1 to your computer and use it in GitHub Desktop.
Save AliYmn/ce4e3075090a05753d9df328a0155fe1 to your computer and use it in GitHub Desktop.
django docker-compose.yml
web:
restart: always
build: ./web
expose:
- "8000"
links:
- postgres:postgres
- redis:redis
volumes:
- /usr/src/app
- /usr/src/app/static
env_file: .env
environment:
DEBUG: 'true'
command: bash -c "python3 /usr/src/app/manage.py collectstatic --noinput && python3 /usr/src/app/manage.py makemigrations && python3 /usr/src/app/manage.py migrate && /usr/local/bin/gunicorn DjangoBlog.wsgi:application -w 2 -b :8000"
nginx:
restart: always
build: ./nginx/
ports:
- "80:80"
volumes:
- /www/static
volumes_from:
- web
links:
- web:web
postgres:
restart: always
image: postgres:latest
ports:
- "5432"
environment:
- POSTGRES_USER=admin
- POSTGRES_PASSWORD=adminpass
- POSTGRES_DB=djangoproject
volumes:
- pgdata:/var/lib/postgresql/data/
redis:
restart: always
image: redis:latest
ports:
- "6379"
volumes:
- redisdata:/data
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment