docker-compose.yml
version: "3.3"
services:
web:
build:
context: .
dockerfile: Dockerfile
cache_from:
- type=local,src=/tmp/.buildx-cache-new,mode=max
command: |
bash -c "flask db upgrade
flask refresh_releases
gunicorn --worker-class eventlet --bind 0.0.0.0:5000 --workers 1 wsgi:app"
ports:
- "5000:5000"
environment:
CELERY_BROKER_URL: redis://redis:6379
CELERY_RESULT_BACKEND: redis://redis:6379
SOCKETIO_MESSAGE_QUEUE: redis://redis:6379
EVENTLET_NO_GREENDNS: "yes"
MATL_ONLINE_ENV: prod
SQLALCHEMY_DATABASE_URI: postgresql://postgres:password@postgres
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:5000"]
interval: 5s
timeout: 10s
retries: 5
depends_on:
- redis
- postgres
- worker
worker:
build:
context: .
dockerfile: Dockerfile
cache_from:
- type=local,src=/tmp/.buildx-cache-new,mode=max
command: celery --app worker.celery worker --purge --autoscale=4,2 -Ofair --loglevel INFO
environment:
CELERY_BROKER_URL: redis://redis:6379
CELERY_RESULT_BACKEND: redis://redis:6379
SOCKETIO_MESSAGE_QUEUE: redis://redis:6379
EVENTLET_NO_GREENDNS: "yes"
MATL_ONLINE_ENV: prod
depends_on:
- redis
flower:
build:
context: .
dockerfile: Dockerfile
cache_from:
- type=local,src=/tmp/.buildx-cache-new,mode=max
environment:
CELERY_BROKER_URL: redis://redis:6379
CELERY_RESULT_BACKEND: redis://redis:6379
MATL_ONLINE_ENV: prod
command: celery --app worker.celery flower
ports:
- "5555:5555"
depends_on:
- redis
redis:
image: redis:alpine
ports:
- "6379"
postgres:
image: postgres
environment:
POSTGRES_PASSWORD: password
ports:
- "5432"