This repository contains files necessary for building a Docker image of Nginx + Gunicorn + Flask.
- Install Docker.
sudo apt-get update
sudo apt-get -y install apt-transport-https ca-certificates curl software-properties-common
curl -fsSL http://mirrors.aliyun.com/docker-ce/linux/ubuntu/gpg | sudo apt-key add -
sudo add-apt-repository "deb [arch=amd64] http://mirrors.aliyun.com/docker-ce/linux/ubuntu $(lsb_release -cs) stable"
sudo apt-get -y update
sudo apt-get -y install docker-ce
- Install Docker-compose:
sudo -i
curl -L https://github.com/docker/compose/releases/download/1.16.1/docker-compose-`uname -s`-`uname -m` > /usr/local/bin/docker-compose
chmod +x /usr/local/bin/docker-compose
- Build :
sudo mkdir -p /etc/docker
sudo vim /etc/docker/daemon.json
{
"registry-mirrors": ["https://8jlc7x0d.mirror.aliyuncs.com"]
}
sudo systemctl daemon-reload
sudo systemctl restart docker
sudo docker build -t smartlab:latest .
# start service
sudo docker-compose up
# stop service
sudo docker-compose down
After few seconds, open http://<host>
to see the Flask app.