Skip to content

Instantly share code, notes, and snippets.

@Rhymond
Last active July 8, 2018 16:41
Show Gist options
  • Star 8 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save Rhymond/41e9366cf5b63a9a0314fd80ac114586 to your computer and use it in GitHub Desktop.
Save Rhymond/41e9366cf5b63a9a0314fd80ac114586 to your computer and use it in GitHub Desktop.
Dockerize create-react-app or create-react-native-app

How to

  1. Build
docker build . -t react
  1. Run install
docker run -v ${PWD}:/app react create-react-app myapp
  1. Eject APP
docker run -v ${PWD}/myapp:/app react npm run eject
  1. Update myapp/config/webpackDevServer.config.js
watchOptions: {
  poll: true
}
  1. Run APP
docker run -v ${PWD}/myapp:/app -p 3000:3000 react yarn app
FROM node:latest
RUN apt-get update && \
apt-get -y install software-properties-common git-core build-essential automake unzip python-dev python-setuptools && \
rm -rf /var/lib/apt/lists/*
RUN git clone https://github.com/facebook/watchman.git /tmp/watchman
WORKDIR /tmp/watchman
RUN ./autogen.sh
RUN ./configure
RUN make
RUN make install
RUN npm install -g create-react-app \
create-react-native-app \
react-native-cli
WORKDIR /app
@rsolci
Copy link

rsolci commented Dec 15, 2017

Wouldn't be better to install yarn using apt-get?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment