version: '3.8'

services:
  database:
    image: postgres:alpine
    restart: always
    env_file:
      - .env
    ports:
      - "5432:5432"
    healthcheck:
      test: [ "CMD-SHELL", "pg_isready -U postgres" ]
      interval: 10s
      timeout: 5s
      retries: 5

  portfolio:
    build: .
    ports:
      - "4000:4000"
      - "4001:4001"
    restart: unless-stopped
    image: docker.dariusklein.nl/portfolio:latest
    depends_on:
      database:
        condition: service_healthy

  docs:
    build:
      context: .
      dockerfile: ./common/docs/Dockerfile
    ports:
      - "4002:80"
    restart: unless-stopped
    image: docker.dariusklein.nl/portfolio-docs:latest

