-
Notifications
You must be signed in to change notification settings - Fork 5
/
docker-compose.cloudsql.yml
70 lines (65 loc) · 2.31 KB
/
docker-compose.cloudsql.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
# docker compose --env-file .cloudsql_env -f docker-compose.cloudsql.yml -p cgcloudsql build
# docker compose --env-file .cloudsql_env -f docker-compose.cloudsql.yml -p cgcloudsql up -d
version: "3.7"
services:
server:
build:
context: ./
dockerfile: ./services/server/cloudsql.Dockerfile
environment:
- LOGINS=user1:pass1,user2:pass2
- FLASK_APP=cg_server/main.py
- FLASK_ENV=development
- CONFIGFILE=/opt/${CONFIGFILE}
- CONSTANTSFILE=/opt/constants/defs.json
- DATA_PATH=/data
- STATIC_DATA_PATH=/opt/static_data
- CLOUDSQL_CONNECTION_NAME
- POSTGRES_USER
- POSTGRES_PASSWORD
- POSTGRES_DB
- POSTGRES_HOST
- POSTGRES_MAX_CONN=20
# command: "gunicorn --bind :5001 --workers 1 --threads 8 --timeout 0 cg_server.main:app"
command: "flask run --host 0.0.0.0 --port=5001"
ports:
- 5001:5001
working_dir: /app
volumes:
# Mount the volume for the cloudsql proxy.
- cloudsql:/cloudsql
- ./services/server:/app:cached # Mount the server python code at run-time, so that the flask development server can refresh on changes
- ./example_data_genbank:/data:cached # Mount the data at run-time (for database seeding only). Should prevent sending all the data over unnecessarily at build-time
- ./src/constants:/opt/constants:cached
- ./config:/opt/config:cached
- ./static_data:/opt/static_data:cached
depends_on:
- sql_proxy
sql_proxy:
image: gcr.io/cloudsql-docker/gce-proxy:1.19.1
command:
- "/cloud_sql_proxy"
- "-dir=/cloudsql"
- "-instances=${CLOUDSQL_CONNECTION_NAME}"
- "-credential_file=/tmp/keys/keyfile.json"
# Allow the container to bind to the unix socket.
user: root
volumes:
- ${GOOGLE_APPLICATION_CREDENTIALS}:/tmp/keys/keyfile.json:ro
- cloudsql:/cloudsql
frontend:
build:
context: ./
dockerfile: ./services/frontend/Dockerfile
environment:
CONFIGFILE: /app/${CONFIGFILE}
working_dir: /app
volumes:
- ./src:/app/src:cached # Mount the JS code at run-time, so the babel server can recompile the app on file changes
- ./config:/app/config:cached
- ./static_data:/app/static_data:cached
command: "npm start -s"
ports:
- 3000:3000
volumes:
cloudsql: