version: '3.8'

services:
  db:
    image: postgres:12.1-alpine
    container_name: dach_db
    restart: always
    healthcheck:
      test: ["CMD", "pg_isready", "-U", "dach"]
    env_file:
      - ../db.env
    volumes:
      - ./postgres:/var/lib/postgresql/data

  web:
    container_name: dach_web
    healthcheck:
      test:
        [
          "CMD-SHELL",
          "wget -q --spider --proxy=off localhost:5173 || exit 1",
        ]
    restart: always
    ports:
      - '1337:1337'
      - '5173:5173'
    build:
      context: ..
    env_file:
      - ../web.env
    depends_on:
      db:
        condition: service_started

