####################################################################################################################################
# Build stage 1 - Create a distribution of the project which we can copy in the second build stage.
####################################################################################################################################
FROM wildlife_licensing/builder AS builder
WORKDIR /app

# Install app dependencies
COPY package*.json ./
COPY . .
RUN npm ci --production

####################################################################################################################################
# Build stage 2 - Using the distribution from stage 1, build the final docker image with a minimal number of layers.
####################################################################################################################################
FROM wildlife_licensing/base
WORKDIR /app
COPY --from=builder /app/ /app/

CMD [ "node", "src/processor.js" ]
