docker-compose.yml (964B)
1 services: 2 postgres: 3 image: postgres:16-alpine 4 environment: 5 POSTGRES_DB: mysite 6 POSTGRES_USER: mysite 7 POSTGRES_PASSWORD: mysite 8 healthcheck: 9 test: ["CMD-SHELL", "pg_isready -U mysite"] 10 interval: 5s 11 timeout: 3s 12 retries: 5 13 14 redis: 15 image: redis:7-alpine 16 healthcheck: 17 test: ["CMD", "redis-cli", "ping"] 18 interval: 5s 19 timeout: 3s 20 retries: 5 21 22 web: 23 build: 24 context: .. 25 dockerfile: 02-docker-compose-api-tests/Dockerfile 26 ports: 27 - "0:8000" 28 depends_on: 29 postgres: 30 condition: service_healthy 31 redis: 32 condition: service_healthy 33 healthcheck: 34 test: ["CMD", "python3", "-c", "import urllib.request; urllib.request.urlopen('http://localhost:8000/health/')"] 35 interval: 5s 36 timeout: 5s 37 retries: 10 38 command: > 39 sh -c "python3 manage.py migrate --run-syncdb && python3 manage.py runserver 0.0.0.0:8000"