FROM node:20.11

RUN mkdir -p /app && chown node:node /app
WORKDIR /app

USER node

#set up dependencies
COPY --chown=node:node ./<<projectName>>-api/package.json ./

# install dependencies
# TODO: It would be vest to ensure npm install has been run before creating the image for the first time, then the if check can be removed
RUN if test -f package-lock.json ; then npm ci ; else npm i ; fi

EXPOSE 8000