repcofkk/docker-compose.yml

107 lines
2.1 KiB
YAML

version: '3.9'
services:
web:
build: ./app
command: >
sh -c "
python manage.py makemigrations --noinput &&
python manage.py migrate --noinput &&
gunicorn repcofkk.wsgi:application --bind 0.0.0.0:8000
"
ports:
- '8000:8000'
expose:
- 8000
env_file:
- .env
depends_on:
postgres:
condition: service_healthy
volumes:
- static_volume:/home/app/web/static/
- code_volume:/home/app/web/
nginx:
build: ./nginx
ports:
- '80:80'
depends_on:
web:
condition: service_started
volumes:
- static_volume:/home/app/web/static/
celery:
build: ./app
command: celery -A repcofkk worker -l info
volumes:
- code_volume:/home/app/web/
env_file:
- .env
depends_on:
redis:
condition: service_started
web:
condition: service_started
celery-beat:
build: ./app
command: celery -A repcofkk beat -l info
volumes:
- code_volume:/home/app/web/
env_file:
- .env
depends_on:
redis:
condition: service_started
web:
condition: service_started
redis:
container_name: redis
image: redis
restart: always
volumes:
- ./redis:/data
ports:
- "6379:6379"
healthcheck:
test: [ "CMD-SHELL", "redis-cli ping | grep PONG" ]
interval: 1s
timeout: 3s
retries: 5
postgres:
image: postgres:12
volumes:
- postgres_data:/var/lib/postgresql/data/
env_file:
- .env
ports:
- '5432:5432'
healthcheck:
test: [ "CMD-SHELL", "pg_isready -d $${POSTGRES_DB} -U $${POSTGRES_USER}" ]
interval: 10s
timeout: 60s
retries: 3
start_period: 10s
flower:
image: mher/flower
ports:
- "5555:5555"
depends_on:
celery:
condition: service_started
environment:
- CELERY_BROKER_URL=redis://redis:6379/0
healthcheck:
test: [ "CMD", "curl", "-f", "http://localhost:5555/" ]
interval: 30s
timeout: 10s
retries: 5
volumes:
postgres_data:
static_volume:
code_volume: