Skip to content

Instantly share code, notes, and snippets.

@gotraveltoworld
Last active February 6, 2019 16:08
Show Gist options
  • Save gotraveltoworld/5b423cbfc8a05bdd74f1b6c36f894d41 to your computer and use it in GitHub Desktop.
Save gotraveltoworld/5b423cbfc8a05bdd74f1b6c36f894d41 to your computer and use it in GitHub Desktop.
Use docker-compose to build a simple python flask with nginx, connection with unix sock file.
version: '3'
services:
nginx:
container_name: nginx-container
hostname: nginx-flask
build:
context: ./nginx
dockerfile: Dockerfile
restart: always
ports:
- "443:443"
volumes:
- sock:/sock
- ./server_logs:/var/log/nginx
depends_on:
- flask
flask:
container_name: flask-container
hostname: flask
build:
context: ./flask
dockerfile: Dockerfile
restart: always
command: uwsgi --ini uwsgi.ini
volumes:
- sock:/sock
- ./server_logs:/log
- ./flask/apis:/app
extra_hosts:
- "database:192.168.1.1"
volumes:
sock:
upstream uwsgi {
# for a file socket
server unix:///sock/app.sock;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment