Code Monkey home page Code Monkey logo

docker-react-app-template's Introduction

Docker React Template

Setup

  1. Install Docker and docker-compose.
  2. Run docker-compose up -d --build. This will build the environment.

Dev

  1. Spin the container, docker-compose start
  2. To stop, docker-compose stop
  3. To restart, docker-compose start
  4. To remove the container, docker-compose down

Production

  1. Fire up the container, docker-compose -f docker-compose-prod.yml up -d --build
  2. To stop, docker-compose stop
  3. To restart, docker-compose start
  4. To remove the container, docker-compose down

React Router and Nginx

If you are using react router and nginx,

  1. Change the default nginx config:
RUN rm -rf /etc/nginx/conf.d
COPY conf /etc/nginx
  1. Use the file Dockerfile-prod-with-react-router
  2. Create the following folder structures along with the default.conf file:
└── 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;
  }
}

Deploy

How to deploy to AWS

This project was bootstrapped with Create React App

with the help from M. Herman's article

docker-react-app-template's People

Contributors

rsandagon avatar

Stargazers

Mikhail avatar Mr. Langdon avatar

Watchers

James Cloos avatar  avatar  avatar

Forkers

11-tools

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.