Skip to content

Instantly share code, notes, and snippets.

@DEALTALFA
Created February 16, 2021 20:42
Show Gist options
  • Save DEALTALFA/86d538e5ff470dd0a45788ab8144ad21 to your computer and use it in GitHub Desktop.
Save DEALTALFA/86d538e5ff470dd0a45788ab8144ad21 to your computer and use it in GitHub Desktop.
make a docker image for nodejs project
FROM node:latest #FROM to tell which base os to use
ENV NODE_ENV=production # make it productive
WORKDIR /app # telling Working directory where where the command should this is now the root directory
COPY ["package.json", "package-lock.json*", "./"] #copyied this file
RUN npm install -g create-react-app #npm dependencies
RUN npm install #update
COPY project/ . #many file so put in folder then copied insider to root i.e /app
EXPOSE 3000 #exposed the 3000 port
CMD [ "npm", "start" ] #started the server
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment