version: '3.8'

services:
  app:
    build:
      context: .
      dockerfile: Dockerfile
    image: openparsersferav-app:${TAG}
    restart: on-failure:5
    ports:
      - '3004:3000'
    environment:
      - NODE_ENV=${NODE_ENV}
      - DATABASE_URL=${DATABASE_URL}
      - RUN_MIGRATIONS=${RUN_MIGRATIONS:-false}
      - PUPPETEER_SKIP_CHROMIUM_DOWNLOAD=true
      - PUPPETEER_EXECUTABLE_PATH=/usr/bin/chromium-browser
    volumes:
      - ./public/images:/app/public/images
      - ./public/images/cache:/app/public/images/cache
      - ./src/generated:/app/src/generated
    healthcheck:
      test:
        [
          'CMD',
          'wget',
          '--no-verbose',
          '--tries=1',
          '--spider',
          'http://localhost:3000/api/health',
        ]
      interval: 30s
      timeout: 10s
      retries: 3
      start_period: 20s
