series-robot-web/Docker/Prod/docker-compose.yml
2023-01-31 21:03:07 +04:00

57 lines
1.4 KiB
YAML

version: "3.9"
services:
db:
image: postgres
volumes:
- dbdata:/var/lib/postgresql/data
env_file:
- config/db/databasepostgresql_env
rabbitmq:
image: rabbitmq
django:
restart: always
environment:
- DJANGO_SETTINGS_MODULE=config.settings.production
build:
context: ../../
dockerfile: Docker/Prod/Dockerfile
command: >
bash -c "python3 src/manage.py makemigrations
&& python3 src/manage.py migrate
&& gunicorn --chdir src --bind 0.0.0.0:8000 config.wsgi"
ports:
- "8000:8000"
depends_on:
- db
- rabbitmq
volumes:
- static_volume:/django_static
nginx:
image: nginx
ports:
- "80:80"
- "443:443"
volumes:
- ./config/nginx/server.conf:/etc/nginx/conf.d/default.conf:ro
- ./config/certbot/conf:/etc/letsencrypt
- ./config/certbot/www:/var/www/certbot
- static_volume:/django_static
depends_on:
- django
command: "/bin/sh -c 'while :; do sleep 6h & wait $${!}; nginx -s reload; done & nginx -g \"daemon off;\"'"
certbot:
image: certbot/certbot
volumes:
- ./config/certbot/conf:/etc/letsencrypt
- ./config/certbot/www:/var/www/certbot
entrypoint: "/bin/sh -c 'trap exit TERM; while :; do certbot renew; sleep 12h & wait $${!}; done;'"
volumes:
dbdata:
static_volume: