Skip to content

Instantly share code, notes, and snippets.

@natterstefan
Last active February 3, 2021 12:38
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save natterstefan/8c4ab88786aaaff11bf3d8e298541f9e to your computer and use it in GitHub Desktop.
Save natterstefan/8c4ab88786aaaff11bf3d8e298541f9e to your computer and use it in GitHub Desktop.
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