version: '3.8'

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

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


