Last active
February 6, 2019 16:08
-
-
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.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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