Yes, as aholbreich mentioned, I would use npm install / npm start locally on my development machine, simply because it is so simple. This may be possible with docker-compose , mounting volumes, etc., but I think it might be a little difficult to set up.
For deployment, you can very easily use the Docker file. Here is an example of a Dockerfile that I am using:
FROM node:6.9 # Create app directory RUN mkdir -p /src/app WORKDIR /src/app # to make npm test run only once non-interactively ENV CI=true # Install app dependencies COPY package.json /src/app/ RUN npm install && \ npm install -g pushstate-server # Bundle app source COPY . /src/app # Build and optimize react app RUN npm run build EXPOSE 9000 # defined in package.json CMD [ "npm", "run", "start:prod" ]
You need to add the start:prod option to your package.json:
"scripts": { "start": "react-scripts start", "start:prod": "pushstate-server build", "build": "react-scripts build", "test": "react-scripts test --env=jsdom", "eject": "react-scripts eject" },
You can run tests in the CI service with:
docker run <image> npm test
There is nothing stopping you from starting this docker container to make sure everything is working as expected.
metakermit
source share