Skip to content

Utilizing docker-compose to tie a flask application with react through nginx

License

Notifications You must be signed in to change notification settings

AndrewRPorter/flask-react-nginx

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

flask-react-nginx

Basic setup connecting flask to a react node application.

client

The client directory was created using create-react-app. There are two Dockerfiles used for the client. One is for local development, using the node development server. The other builds the app into static files which are then served to nginx.

server

The server is responsible for exposing an api endpoint for client consumption.

Development

docker-compose -f conf/docker-dev.yml up

I have made this easier by adding a dev script

./scripts/dev.sh

Note that the react development server will compile and refresh on file changes

Production

docker-compose -f conf/docker-prod.yml up

I have made this easier by adding a production script

./scripts/prod.sh

Usage

  • expose new api endpoints in the server view
  • read from endpoints in client