-
Notifications
You must be signed in to change notification settings - Fork 0
/
docker-compose.yml
81 lines (75 loc) · 2.6 KB
/
docker-compose.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
version: '3'
services:
flask:
build:
context: app
dockerfile: Dockerfile
# Note: If your service specifies a build option, variables defined in environment files are not automatically visible
# during the build. Use the args sub-option of build to define build-time environment variables.
# Environment variables traverse through docker-compose.yml via .env file, then through "build: args" as build-time only
# environment variables and then assigned into ARG in Dockerfile and finally used as ${var_name} in the Dockerfile
args:
- MAINTAINER_NAME=${MAINTAINER_NAME}
- FLASK_USER=${FLASK_USER}
- FLASK_ID=${FLASK_ID}
- FLASK_PORT=${FLASK_PORT}
- FLASK_DEFAULT_IP_ADDRESS=${FLASK_DEFAULT_IP_ADDRESS}
- FLASK_REMOTE_ROOT_DIR=${FLASK_REMOTE_ROOT_DIR}
- FLASK_LOG_DIR=${FLASK_LOG_DIR}
container_name: flask
restart: unless-stopped
environment:
FLASK_ENV: ${FLASK_ENV}
FLASK_DEBUG: ${FLASK_DEBUG}
FLASK_PORT: ${FLASK_PORT}
FLASK_SEARCH: ${FLASK_SEARCH}
FLASK_DEFAULT_IP_ADDRESS: ${FLASK_DEFAULT_IP_ADDRESS}
FLASK_DEFAULT_IP_ADDRESS_AND_PORT: ${FLASK_DEFAULT_IP_ADDRESS_AND_PORT}
MONGODB_USER: ${MONGODB_USER}
MONGODB_PWD: ${MONGODB_PWD}
MONGODB_CLUSTER: ${MONGODB_CLUSTER}
MONGODB_DB: ${MONGODB_DB}
MONGODB_COLLECTION: ${MONGODB_COLLECTION}
MONGODB_URI_PREFIX: ${MONGODB_URI_PREFIX}
MONGODB_URI_SUFFIX: ${MONGODB_URI_SUFFIX}
MONGODB_URI_EXTRA_PYTHON_SUFFIX: ${MONGODB_URI_EXTRA_PYTHON_SUFFIX}
# MONGODB_DATA_DIR: ${MONGODB_DATA_DIR}
# MONGODB_LOG_DIR: ${MONGODB_LOG_DIR}
volumes:
- ./app:${FLASK_REMOTE_ROOT_DIR} # for remote debugging purpose IN the container
- flaskdata:${FLASK_LOG_DIR}
networks:
- frontend
webserver:
build:
context: nginx
dockerfile: Dockerfile
args:
- MAINTAINER_NAME=${MAINTAINER_NAME}
container_name: webserver # If not specified, automatically named as #{PWD}_{this service name}
restart: unless-stopped
ports:
- ${HOST_NGINX__PORT_1}:80
- ${HOST_NGINX__PORT_2}:443
volumes:
- nginxlog:${NGINX_LOG_DIR}
depends_on:
- flask
networks:
- frontend
networks:
frontend:
driver: bridge
volumes:
flaskdata:
driver: local
driver_opts:
type: none #if "bind", then bind mount
device: $PWD${FLASK_HOST_LOG_DIR} # must be an ABSOLUTE PATH
o: bind
nginxlog:
driver: local
driver_opts:
type: none
device: $PWD${NGINX_HOST_LOG_DIR} # must be an ABSOLUTE PATH
o: bind