Skip to content
Snippets Groups Projects
Commit 96f47c12 authored by esikkala's avatar esikkala
Browse files

Update Dockerfile for Node.js 16

parent b1292cdc
No related branches found
No related tags found
No related merge requests found
FROM node:14.15.1-alpine
FROM node:16.13.0-alpine
ARG API_URL
# Create app directory
RUN mkdir /opt/app && chown node:node /opt/app
RUN apk add --update git && \
rm -rf /tmp/* /var/cache/apk/*
# Based on https://nodejs.org/en/docs/guides/nodejs-docker-webapp/
WORKDIR /opt/app
# Create app directory
WORKDIR /usr/src/app
# Install app dependencies
# A wildcard is used to ensure both package.json AND package-lock.json are copied
......@@ -21,14 +18,14 @@ COPY babel.config.js ./
# Bundle app source
COPY src ./src
# https://github.com/nodejs/docker-node/blob/main/docs/BestPractices.md#non-root-user
USER node
# Run the scripts defined in package.json
RUN npm install && \
API_URL=$API_URL npm run build
EXPOSE 3001
# https://github.com/nodejs/docker-node/blob/main/docs/BestPractices.md#non-root-user
USER node
# Express server handles the backend functionality and also serves the React app
CMD ["node", "/opt/app/dist/server"]
CMD ["node", "/usr/src/app/dist/server"]
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment