Skip to content

Instantly share code, notes, and snippets.

@lysandroc
Created June 7, 2019 22:40
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 lysandroc/9d4d86eca92cedd0d4e6326a50bb0e55 to your computer and use it in GitHub Desktop.
Save lysandroc/9d4d86eca92cedd0d4e6326a50bb0e55 to your computer and use it in GitHub Desktop.
dockerfile for react app
FROM node:8.11.1-alpine
# Provides cached layer for node_modules
ADD package.json /tmp/package.json
RUN cd /tmp && npm install
RUN mkdir -p /app && cp -a /tmp/node_modules /app/node_modules
# Define working directory
WORKDIR /app
# Add everything in the current directory to our image, in the 'app' folder.
COPY ./src/ ./src
COPY ./public/ ./public
COPY ./package.json ./package.json
#RUN npm install -g npm-run-all
#RUN npm install -g react-scripts@2.1.3
#RUN npm install -g node-sass-chokidar@1.3.3
RUN npm run build
# Run our app.
CMD ["npm", "start"]
template react dockerfile
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment