version: "3.8" services: db: image: postgres:latest restart: always environment: POSTGRES_USER: postgres POSTGRES_PASSWORD: mypassword ports: - "5432:5432" healthcheck: test: ["CMD-SHELL", "pg_isready -U your_user"] interval: 10s retries: 5 start_period: 30s timeout: 5s volumes: - db_data:/var/lib/postgresql/data web: build: context: . dockerfile: Dockerfile ports: - "3000:3000" env_file: - .env.local depends_on: db: condition: service_healthy volumes: db_data: