componentsApi: "1.0"
generator:
  dofigen:
    builders:
      - name: module-loader
        from: &image "docker.io/bitnami/node:18"
        workdir: /tmp/module
        adds:
          - package.json
          - package-lock.json
        script:
          - npm i --production  --cache /tmp/cache
        caches:
          - /tmp/cache
      - name: builder
        from: *image
        workdir: /tmp/app
        adds:
          - .
        script:
          - npm i --cache /tmp/cache
          - npm run build
        caches:
          - /tmp/cache
    from: *image
    workdir: /app
    artifacts:
      - builder: module-loader
        source: "/tmp/module/"
        destination: "/app/"
      - builder: builder
        source: "/tmp/app/dist/"
        destination: "/app/dist/"
      - builder: builder
        source: "/tmp/app/resources/"
        destination: "/app/resources/"
    cmd:
      - npm
      - start
    ports:
      - 3000
    envs:
      suppress_lock: "true"
    healthcheck:
      cmd: curl --fail http://localhost:8080/_/health
      start: 3s
      interval: 3s
      timeout: 1s
    ignores:
      - "**"
      - "!/*.json"
      - "!/src/"
      - "!/resources/"
