Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Docker | Simple NodeJS Dockerfile
# We use the latest nodejs@14 image as our base image
FROM node:14-alpine
# set the default NODE_NEV to production
ENV NODE ENV=production
# make sure everything happens inside the /app folder
WORKDIR/app
# now we cache the node_modules layer
COPY ["package.json", "package-lock.json", "./"]
# install your dependencies
RUN npm install
# copy the source
COPY /src .
# and start the app
CMD ["node", "server. js"]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment