Created
October 3, 2018 11:19
-
-
Save mohamednizar/4e2d3d2ea2a9b5acea04eecf035ff71d to your computer and use it in GitHub Desktop.
Dockerize React Project
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# ./docker-compose.yml | |
version: '2' | |
web: | |
build: ./app | |
hostname: www | |
domainname: sleas.dev | |
volumes: | |
- './app/node_modules:/usr/app/node_modules' | |
- './app/src:/usr/app/src' | |
- './app/public:/usr/app/public' | |
ports: | |
- 3000:3000 | |
environment: | |
- NODE_ENV=development |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# base image | |
FROM node:9.6.1 | |
# set working directory | |
RUN mkdir /usr/app | |
WORKDIR /usr/app | |
# add `/usr/src/app/node_modules/.bin` to $PATH | |
ENV PATH /usr/app/node_modules/.bin:$PATH | |
# install and cache app dependencies | |
COPY package.json /usr/app/package.json | |
RUN npm install --silent | |
RUN npm install ngx -g --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