241-327_Deev_ASD/lab-2/local/docker-compose.yaml

45 lines
1.1 KiB
YAML

name: lab2-local
services:
postgres_service:
# https://hub.docker.com/_/postgres
image: postgres:alpine
env_file:
- .env
healthcheck:
test: ["CMD-SHELL", "pg_isready -U $$POSTGRES_USER -d $$POSTGRES_DB"]
interval: 10s
timeout: 30s
retries: 5
volumes:
- postgres_data:/var/lib/postgresql/data
backend_service:
build: ./backend
command: > # python manage.py createsuperuser --noinput &&
sh -c "python manage.py migrate &&
python manage.py shell -c 'from quiz.gentestdata import gentestdata; gentestdata()' &&
python manage.py collectstatic --no-input &&
gunicorn lab1.wsgi:application --bind 0.0.0.0:8000"
volumes:
- static_volume:/app/staticfiles
env_file:
- .env
depends_on:
postgres_service:
condition: service_healthy
restart: unless-stopped
nginx_service:
build: ./nginx
ports:
- "80:80"
volumes:
- static_volume:/staticfiles
depends_on:
- backend_service
restart: unless-stopped
volumes:
static_volume:
postgres_data: