version: "3"
services:

  # backend nodejs API
  <<projectName>>-be:
    build:
      context: .
      dockerfile: Dockerfile.be.dev
    container_name: <<projectName>>-be
    volumes:
      - ./<<projectName>>-be:/app
      - /app/node_modules
    user: node
    command: bash -c "npm run db:migrate && npm run dev"
    environment:
      # container internal port (not exposed to host)
      - PORT=8080
      # db config
      - <<dbNameKey>>=<<projectName>>
      - <<dbUserKey>>=databaseUser
      - <<dbPassword>>=databasePw1!
      - <<dbHost>>=db
    stdin_open: true
    tty: true
    restart: always
    depends_on:
      db:
        condition: service_healthy
    healthcheck:
      test: curl -f http://localhost:$$PORT/health
      timeout: 10s
      retries: 5
    profiles:
      - local
      - ""
