-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdocker-compose.yml
188 lines (177 loc) · 4.99 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
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
version: "3.9"
services:
# dynamo
dynamo:
image: "amazon/dynamodb-local:1.20.0"
container_name: dynamodb
build:
context: ./src/pet_match_stack
dockerfile: dynamo.Dockerfile
# create shell
tty: true
ports:
- "8001:8001"
# mount local user data file to dynamo container
volumes:
- "./src/data/dynamodb:/home/dynamodblocal/data"
working_dir: /home/dynamodblocal
networks:
- pet_match_network
# setup db
db-setup:
build:
context: ./src/pet_match_stack/db-setup
dockerfile: db-setup.Dockerfile
# don't start before dynamo
depends_on:
- dynamo
# create shell
tty: true
ports:
- "8002:8002"
# links to dynamo
links:
- dynamo
networks:
- pet_match_network
# mount data to db setup container
volumes:
- type: volume
# use the named volume as the source
source: pet-data
# i.e. your local_dir_absolute path will be mounted to target of next section (bind)
target: $BASE_PATH/data/raw
volume:
nocopy: true
- type: bind
# use the named volume's target as the source
source: $BASE_PATH/data/raw
target: /app/data
# do not allow app interface to write to pet-data volume
read_only: true
# fastapi backend
fastapi:
build:
context: ./src/pet_match_stack/api
dockerfile: fastapi.Dockerfile
# create shell
tty: true
# mount local user data file to fastapi container
volumes:
- "./src/pet_match_stack/api/app:/src/app"
- "$BASE_PATH/models:/src/app/models"
ports:
- "8086:8086"
# links to dynamo
links:
- dynamo
networks:
- pet_match_network
# petmatch model backend
model-backend:
build:
context: ./src/pet_match_stack/api/model-api
dockerfile: petmatch-model-backend.Dockerfile
# create shell
tty: true
# mount local user data file to fastapi models container
volumes:
- "./src/pet_match_stack/api/model-api:/src/app"
ports:
- "8087:8087"
# links to dynamo
links:
- dynamo
networks:
- pet_match_network
# streamlit
streamlit:
build:
context: ./src/visualization
dockerfile: streamlit.Dockerfile
# create shell
tty: true
ports:
- "8501:8501"
# links to dynamo
links:
- dynamo
networks:
- pet_match_network
# set env vars
environment:
AWS_ACCESS_KEY_ID: 'DUMMYIDEXAMPLE' # Note: these are dummy values
AWS_SECRET_ACCESS_KEY: 'DUMMYEXAMPLEKEY' # See: https://github.com/awsdocs/amazon-dynamodb-developer-guide/blob/master/doc_source/DynamoDBLocal.UsageNotes.md
AWS_DEFAULT_REGION: us-east-1
AWS_DYNAMODB_ENDPOINT: http://dynamodb:8001
# AWS_DYNAMODB_TABLE: pet_match
REGION: 'us-east-1'
# mount data to streamlit container
volumes:
- type: volume
# use the named volume as the source
source: pet-data
# i.e. your local_dir_absolute path will be mounted to target of next section (bind)
target: $BASE_PATH/data/raw
volume:
nocopy: true
- type: bind
# use the named volume's target as the source
source: $BASE_PATH/data/raw
target: /app/data
# do not allow app interface to write to pet-data volume
read_only: true
# create a new named volume for storing user rankings within repository
- type: volume
# use the named volume as the source
source: user-rankings
# i.e. your local_dir_absolute path will be mounted to target of next section (bind)
target: $BASE_PATH/data/rankings
volume:
# allow copying
nocopy: false
- type: bind
# use the named volume's target as the source
source: $BASE_PATH/data/rankings
target: /app/rankings
# allow writing to the volume
read_only: false
# create a new named volume for application visualization code
- type: volume
# use the named volume as the source
source: code
# i.e. your local_dir_absolute path will be mounted to target of next section (bind)
target: $BASE_PATH/src/visualization
volume:
# allow copying
nocopy: false
- type: bind
# use the named volume's target as the source
source: ./src/visualization
target: /app
# allow writing to the volume
read_only: false
frontend:
image: node:16-alpine
container_name: frontend
env_file: ./src/frontend/.env
build:
context: ./src/frontend
dockerfile: frontend.Dockerfile
# create shell
tty: true
ports:
- "3000:3000"
# mount local user data file to dynamo container
volumes:
- "./src/frontend:/app/frontend/"
working_dir: /app/frontend
networks:
- pet_match_network
volumes:
pet-data:
user-rankings:
code:
# make sure to add containers to this network
networks:
pet_match_network: