Dockerizing Angular 2, Flask, NodeJS, and MongoDB With Docker-Compose and Docker-Machine - From Localhost to the Cloud
MIT License
Goal:
The goal of this repository is to have a quickly sharable, deployable docker setup for Python and Node web services adhering to best-practices. Nginx serves the static content and provides a reverse proxy to Python/Flask and NodeJS/Express web service apis. Since Nginx, Python, and NodeJS are in separate (linked) docker containers, each service has a separate IP from the host docker-machine. Due to this, nginx reverse-proxies requests over specific TCP ports between containers, as opposed to using a unix socket implementation. A benefit of this linked container implementation is a smaller footprint than a docker server image, and that proxies do not go through the externally-exposed docker-machine host.
Stack:
Getting up and running:
Install Docker Toolbox - https://docs.docker.com/engine/getstarted/step_one/
Run the following from a terminal within this project root:
npm install
npm run dev
Verify proper docker build from the browser:
Retrieve docker-machine ip address from the terminal/cmd prompt:
docker-machine ip
Static assets served from Nginx:
Flask API REST end-point:
NodeJS API REST end-point:
Reminder: "docker-machine-ip" above refers to the host IP of the docker-machine returned from the terminal on this command:
docker-machine ip
Cheers!