- Install Docker and docker-compose.
- Run
docker-compose up -d --build. This will build the environment.
- Spin the container,
docker-compose start - To stop,
docker-compose stop - To restart,
docker-compose start - To remove the container,
docker-compose down
- Fire up the container,
docker-compose -f docker-compose-prod.yml up -d --build - To stop,
docker-compose stop - To restart,
docker-compose start - To remove the container,
docker-compose down
If you are using react router and nginx,
- Change the default nginx config:
RUN rm -rf /etc/nginx/conf.d
COPY conf /etc/nginx- Use the file
Dockerfile-prod-with-react-router - Create the following folder structures along with the
default.conffile:
└── conf
└── conf.d
└── default.conf
default.conf:
server {
listen 80;
location / {
root /usr/share/nginx/html;
index index.html index.htm;
try_files $uri $uri/ /index.html;
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root /usr/share/nginx/html;
}
}