Skip to content

Instantly share code, notes, and snippets.

@abdullahceylan
Last active December 5, 2018 20:26
Show Gist options
  • Save abdullahceylan/68fb2318382ae57831bbd3ff6460b296 to your computer and use it in GitHub Desktop.
Save abdullahceylan/68fb2318382ae57831bbd3ff6460b296 to your computer and use it in GitHub Desktop.
create-react-app Dockerfile
version: '3.5'
services:
sample-app:
container_name: calculator
build:
context: .
dockerfile: Dockerfile
volumes:
- '.:/usr/src/app'
- '/usr/src/app/node_modules'
ports:
- '3000:3000'
environment:
- NODE_ENV=development
# base image
FROM node:9.6.1
# set working directory
RUN mkdir /usr/src/app
WORKDIR /usr/src/app
# add `/usr/src/app/node_modules/.bin` to $PATH
ENV PATH /usr/src/app/node_modules/.bin:$PATH
# install and cache app dependencies
COPY package.json /usr/src/app/package.json
RUN npm install --silent
RUN npm install react-scripts@1.1.1 -g --silent
# start app
CMD ["npm", "start"]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment