forked from craws/OpenAtlas
-
Notifications
You must be signed in to change notification settings - Fork 0
/
docker-compose.yaml
63 lines (61 loc) · 2.36 KB
/
docker-compose.yaml
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
version: "3.9"
services:
postgres:
image: "postgis/postgis:15-3.4"
environment:
- POSTGRES_DB=${POSTGRES_DB}
- POSTGRES_PASSWORD=${POSTGRES_PASSWORD}
- POSTGRES_USER=openatlas
# ports:
# - "25432:5432"
volumes:
- ./data/db:/var/lib/postgresql/data
# Installation of an empty database
# - ./install/0_extensions.sql:/docker-entrypoint-initdb.d/0_extensions.sql
# - ./install/1_structure.sql:/docker-entrypoint-initdb.d/1_structure.sql
# - ./install/2_data_model.sql:/docker-entrypoint-initdb.d/2_data_model.sql
# - ./install/3_data_web.sql:/docker-entrypoint-initdb.d/3_data_web.sql
# - ./install/4_data_type.sql:/docker-entrypoint-initdb.d/4_data_type.sql
# Import dump (comment install section above)
# - ./files/export/dump.sql:/docker-entrypoint-initdb.d/dump.sql
healthcheck:
test: ["CMD-SHELL", "sh -c 'PGPASSWORD=${POSTGRES_PASSWORD} psql -h localhost -U openatlas -d ${POSTGRES_DB} -c \\\\q'"]
interval: 10s
timeout: 5s
retries: 30
initdb:
build:
context: .
dockerfile: install/docker/Dockerfile
ports:
- "8080:8080"
environment:
- POSTGRES_DB=${POSTGRES_DB}
- POSTGRES_HOST=postgres
- POSTGRES_PASSWORD=${POSTGRES_PASSWORD}
- POSTGRES_USER=openatlas
entrypoint: >
/bin/bash -c 'if [ "$$( psql postgres://openatlas:$$POSTGRES_PASSWORD@$$POSTGRES_HOST:5432/$$POSTGRES_DB -tAc "SELECT 1 FROM web.settings WHERE id = 1" )" == '"'"'1'"'"' ]; then echo '"'"'Database has already data'"'"'; else cd /var/www/openatlas/install && cat [0-9]_*.sql | psql postgres://openatlas:$$POSTGRES_PASSWORD@$$POSTGRES_HOST:5432/$$POSTGRES_DB -f -; fi'
depends_on:
postgres:
condition: service_healthy
openatlas:
build:
context: .
dockerfile: install/docker/Dockerfile
ports:
- "8080:8080"
environment:
- POSTGRES_DB=${POSTGRES_DB}
- POSTGRES_HOST=postgres
- POSTGRES_PASSWORD=${POSTGRES_PASSWORD}
- POSTGRES_USER=openatlas
volumes:
- ./files/uploads:/var/www/openatlas/files/uploads
- ./files/processed_images/resized:/var/www/openatlas/files/processed_images/resized
- ./files/export/:/var/www/openatlas/files/export/
depends_on:
postgres:
condition: service_healthy
initdb:
condition: service_completed_successfully