WebServer/docker-compose.yaml

52 lines
1.4 KiB
YAML
Executable File
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

services:
database:
image: postgres:17.4-alpine3.21
container_name: database
ports:
- "5432:5432"
environment:
POSTGRES_DB: ${POSTGRES_DB}
POSTGRES_USER: ${POSTGRES_USER}
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD}
#Монтируем директорию на хосте, чтобы при повторных "docker-compose up" таблицы с нашими данными сохранялись
volumes:
- /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:1.27.4-alpine
container_name: webserver
ports:
- "80:80"
- "443:443"
volumes:
- /WebApp/frontend:/usr/share/nginx/html
- /WebApp/nginx/ssl:/etc/nginx/sites-available
- /WebApp/nginx/nginx.conf:/etc/nginx/nginx.conf
depends_on:
- database
- backend
cpus: '0.15'
mem_limit: 256M
backend:
image: python:3.9
container_name: backend_part
ports:
- "5000:5000"
volumes:
- /WebApp/backend:/media/backend
working_dir: /media/backend
command: >
sh -c "pip install -r requirements.txt && python server.py"
cpus: '0.35'
mem_limit: 256M