-
Notifications
You must be signed in to change notification settings - Fork 0
/
docker-compose.yml
79 lines (71 loc) · 1.97 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
version: "3.7"
services:
nginx:
depends_on:
- flask
build: ./nginx_web_server
# 2. Mount that Docker volume to "/static" folder in Nginx container
volumes:
- static_volume:/static
ports:
# Bind container port 80 to the host port 80
- "80:80"
restart: always
flask:
depends_on:
- user_service
- post_service
- redis
build: ./flask_app
environment:
- C_FORCE_ROOT=1
# To let Nginx serve static information (like CSS files, pictures, etc.):
# 1. Expose "/static" folder to a Docker volume
volumes:
- static_volume:/flask_blog_app/flask_blog/static
expose:
# Since we'll use Gunicorn to run the application, we need to expose its
# default port 8000, rather than the default port 5000 of Flask
# development server.
- 8000
# Note that this port is only exposed to other services in the same
# network, but not to outside world
restart: always
user_service:
depends_on:
- db
build: ./user_service
expose:
- 8000
restart: always
post_service:
depends_on:
- db
build: ./post_service
expose:
- 8000
restart: always
db: # Note that this is also the hostname of the "db" service container
image: postgres:9.6
environment:
- POSTGRES_USER=postgres
- POSTGRES_PASSWORD=password
- POSTGRES_DB=flask_blog
# Persist the data stored in the database into a Docker volume
volumes:
- db_volume:/var/lib/postgresql/data
expose:
- 5432
# Note that this port is only exposed to other services in the same
# network, but not to outside world
restart: always
redis: # Note that this is also the hostname of the "redis" service container
image: redis
expose:
- 6379
# Note that this port is only exposed to other services in the same
# network, but not to outside world
restart: always
volumes:
static_volume:
db_volume: