-
Notifications
You must be signed in to change notification settings - Fork 10
Expand file tree
/
Copy pathdocker-compose.yaml
More file actions
112 lines (105 loc) · 3.03 KB
/
docker-compose.yaml
File metadata and controls
112 lines (105 loc) · 3.03 KB
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
x-common-infos:
# Env variables stored in a .env file at same level than docker-compose.yaml
environment: &common-env
POSTGRES_HOSTNAME: ${POSTGRES_HOSTNAME:-postgres_bloom}
POSTGRES_DB: ${POSTGRES_DB:-bloom_db}
POSTGRES_USER: ${POSTGRES_USER:-bloom_user}
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD:-bloom}
LOGGING_LEVEL: ${LOGGING_LEVEL:-INFO}
services:
bloom-backend:
container_name: bloom_backend
hostname: bloom-backend
image: d4g/bloom:${VERSION:-latest}
working_dir: /project/backend
command:
- bash
- -c
- |
echo "Starting Scheduler" &&
cron -f -L 2
volumes:
- ./:/project/
- ./data:/project/data
environment:
<<: *common-env
POSTGRES_PORT: 5432
STREAMLIT_SERVER_ADDRESS: ${STREAMLIT_SERVER_ADDRESS:-0.0.0.0}
ports:
- 8501:8501
networks:
- bloom_net
depends_on:
bloom-init:
condition: service_completed_successfully
bloom-postgres:
container_name: postgres_bloom
hostname: bloom-postgres
image: ${POSTGIS_IMAGE:-postgis/postgis:14-3.3-alpine}
environment:
<<: *common-env
ports:
- ${POSTGRES_PORT:-5432}:5432
networks:
- bloom_net
healthcheck:
test:
[
'CMD-SHELL',
"for i in 1 2 3; do pg_isready --quiet --dbname=$${POSTGRES_DB:-bloom_db} --username=$${POSTGRES_USER:-bloom_user} && break || sleep 5; done"
]
interval: 15s
timeout: 45s
retries: 3
start_period: 0s
bloom-frontend:
container_name: bloom_frontend
hostname: bloom-frontend
image: d4g/bloom:${VERSION:-latest}
command: env node ./node_modules/next/dist/bin/next start --hostname 0.0.0.0
working_dir: /project/frontend
volumes:
- ./:/project/
- ./data:/project/frontend/public/data
environment:
LOGGING_LEVEL: ${LOGGING_LEVEL:-INFO}
networks:
- bloom_net
ports:
- ${HTTP_PORT:-3000}:3000
depends_on:
bloom-init:
condition: service_completed_successfully
bloom-init:
container_name: bloom_init
hostname: bloom-init
image: d4g/bloom:${VERSION:-latest}
# Nominal start:
# As postgres+postgis gt available, then unavialable, then avialable at database init
# it happens that init is launch before second and definitve postgres healthy state
# and fails
# so giving init 3 chances and 15 seconds to init before failing
command: /bin/bash -c "cd backend;alembic upgrade head"
# Debug start:
#command: bash
#tty: true
#stdin_open: true
build:
context: .
dockerfile: ./docker/Dockerfile
args:
IMAGE_PYTHON: ${IMAGE_PYTHON:-python:3.10-slim-bullseye}
POETRY_VERSION: ${POETRY_VERSION:-1.8.2}
environment:
<<: *common-env
POSTGRES_PORT: 5432
volumes:
- ./:/project/
networks:
- bloom_net
depends_on:
bloom-postgres:
condition: service_healthy # The service is working and still running
networks:
bloom_net:
name: bloom_net