WebServer/docker/docker-compose.yml

52 lines
1.5 KiB
YAML
Raw Normal View History

services:
DataBase:
image: postgres:latest
container_name: DataBase
ports:
- "5432:5432"
#Так никто не делает в реальных кейсах, я просто даун, не умею работать с секретами (опция secrets)
environment:
POSTGRES_USER: user
POSTGRES_PASSWORD: password
POSTGRES_DB: WebSite
volumes:
- /home/git/myprojects/database:/var/lib/postgresql/data
cpus: '0.15'
mem_limit: 256M
healthcheck:
test: ["CMD-SHELL", "pg_isready -U admin -WebSite"]
interval: 5s
timeout: 5s
retries: 5
webserver:
image: nginx:latest
container_name: WebServer
ports:
- "80:80"
- "443:443"
volumes:
- /home/git/myprojects/WorkServer/frontend:/usr/share/nginx/html
- /home/git/myprojects/WorkServer/conf:/etc/nginx/sites-available
depends_on:
- DataBase
- backend
cpus: '0.15'
mem_limit: 256M
backend:
image: python:3.9
container_name: backend_part
ports:
- "5000:5000"
volumes:
- /home/git/myprojects/WorkServer/backend:/media/backend
- /home/git/myprojects/WorkServer/frontend:/media/frontend
working_dir: /media/backend
command: >
sh -c "pip install -r requirements.txt && python server.py"
cpus: '0.35'
mem_limit: 256M