ConceptPortal-public/docker-compose-prod.yml
2023-08-09 16:55:53 +03:00

78 lines
1.6 KiB
YAML

volumes:
postgres_volume:
name: "postgresql-db"
django_static_volume:
name: "static"
django_media_volume:
name: "media"
networks:
default:
name: concept-api-net
secrets:
django_key:
file: ./secrets/django_key.txt
db_password:
file: ./secrets/db_password.txt
services:
frontend:
restart: always
depends_on:
- backend
build:
context: ./rsconcept/frontend
expose:
- 3000
command: serve -s /home/node -l 3000
backend:
restart: always
depends_on:
- postgresql-db
secrets:
- db_password
- django_key
build:
context: ./rsconcept/backend
env_file: ./rsconcept/backend/.env.prod
environment:
SECRET_KEY: /run/secrets/django_key
DB_PASSWORD: /run/secrets/db_password
expose:
- 8000
volumes:
- django_static_volume:/home/app/web/static
- django_media_volume:/home/app/web/media
command:
gunicorn -w 3 project.wsgi --bind 0.0.0.0:8000
postgresql-db:
restart: always
image: postgres:alpine
secrets:
- db_password
env_file: ./postgresql/.env.prod
environment:
POSTGRES_PASSWORD: /run/secrets/db_password
volumes:
- postgres_volume:/var/lib/postgresql/data
nginx:
restart: always
build:
context: ./nginx
ports:
- 8000:8000
- 3000:3000
depends_on:
- backend
command: "/bin/sh -c 'while :; do sleep 6h & wait $${!}; nginx -s reload; done & nginx -g \"daemon off;\"'"
volumes:
- django_static_volume:/var/www/static
- django_media_volume:/var/www/media