docker-compose.yml57 lines, 1.2 KB
| 1 | services: |
| 2 | app: |
| 3 | build: |
| 4 | context: . |
| 5 | dockerfile: Dockerfile |
| 6 | ports: |
| 7 | - 8080:8080 |
| 8 | env_file: |
| 9 | - .env |
| 10 | depends_on: |
| 11 | postgres: |
| 12 | condition: service_healthy |
| 13 | redis: |
| 14 | condition: service_healthy |
| 15 | restart: always |
| 16 | healthcheck: |
| 17 | test: ["CMD", "wget", "--spider", "-q", "http://localhost:8080"] |
| 18 | interval: 30s |
| 19 | timeout: 10s |
| 20 | retries: 5 |
| 21 | |
| 22 | postgres: |
| 23 | image: postgres:17-alpine |
| 24 | ports: |
| 25 | - 5432:5432 |
| 26 | environment: |
| 27 | - POSTGRES_USER=${POSTGRES_USER:-postgres} |
| 28 | - POSTGRES_PASSWORD=${POSTGRES_PASSWORD:-postgres} |
| 29 | - POSTGRES_DB=${POSTGRES_DB:-video_summarizer} |
| 30 | volumes: |
| 31 | - postgres_data:/var/lib/postgresql/data |
| 32 | healthcheck: |
| 33 | test: ["CMD", "pg_isready", "-U", "${POSTGRES_USER:-postgres}", "-d", "${POSTGRES_DB:-video_summarizer}"] |
| 34 | interval: 10s |
| 35 | timeout: 5s |
| 36 | retries: 5 |
| 37 | restart: always |
| 38 | |
| 39 | redis: |
| 40 | image: redis:7-alpine |
| 41 | ports: |
| 42 | - 6379:6379 |
| 43 | volumes: |
| 44 | - redis_data:/data |
| 45 | healthcheck: |
| 46 | test: ["CMD", "redis-cli", "ping"] |
| 47 | interval: 1m30s |
| 48 | timeout: 30s |
| 49 | retries: 5 |
| 50 | start_period: 30s |
| 51 | restart: always |
| 52 | |
| 53 | volumes: |
| 54 | postgres_data: |
| 55 | redis_data: |
| 56 | |
| 57 |