2021-11-01 16:42:52 -06:00
|
|
|
# base image
|
2023-01-31 18:08:07 -07:00
|
|
|
FROM node:18-bullseye
|
2021-11-01 16:42:52 -06:00
|
|
|
|
|
|
|
|
WORKDIR /app
|
|
|
|
|
ENV PATH /app/node_modules/.bin:$PATH
|
|
|
|
|
|
|
|
|
|
# install and cache app dependencies
|
2024-04-14 13:06:03 -06:00
|
|
|
USER root
|
|
|
|
|
RUN npm install -g serve
|
2021-11-01 16:42:52 -06:00
|
|
|
COPY app/public /app/public
|
|
|
|
|
COPY app/src /app/src
|
2023-01-31 18:08:07 -07:00
|
|
|
COPY app/package.json app/package-lock.json /app/
|
2024-04-14 13:06:03 -06:00
|
|
|
# "node" user will run the app after build.
|
2023-01-31 18:08:07 -07:00
|
|
|
RUN chown -R node:node /app
|
2021-11-01 16:42:52 -06:00
|
|
|
|
2024-04-14 13:06:03 -06:00
|
|
|
# Install dependencies as "node", this is to avoid changing ownership of many files.
|
|
|
|
|
USER node
|
|
|
|
|
RUN npm install
|
|
|
|
|
|
2021-11-01 16:42:52 -06:00
|
|
|
# Run the production build
|
2024-10-01 11:30:23 -06:00
|
|
|
CMD ["npm", "run", "start"]
|