-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathdocker-compose.yml
62 lines (60 loc) · 1.82 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
version: "3.9"
services:
postgres-db:
image: ${POSTGRES_DOCKER_IMAGE}
container_name: snb-interactive-postgres
ports:
- "${POSTGRES_PORT}:${POSTGRES_PORT}"
volumes:
- type: bind
source: ${POSTGRES_CSV_DIR}
target: /data/
- type: bind
source: ${POSTGRES_CUSTOM_CONFIGURATION}
target: /etc/postgresql.conf
# Uncomment to persist data
# - type: bind
# source: ${POSTGRES_CSV_DIR}
# target: /var/lib/postgresql/data
- type: bind
source: ${POSTGRES_SCRIPTS_DIR}/create-postgresdb.sh
target: /docker-entrypoint-initdb.d/init-user-db.sh
environment:
- POSTGRES_DATABASE=${POSTGRES_DATABASE}
- POSTGRES_USER=${POSTGRES_USER}
- POSTGRES_PASSWORD=${POSTGRES_PASSWORD}
- POSTGRES_DOCKER_PLATFORM_FLAG=${POSTGRES_DOCKER_PLATFORM_FLAG}
- tz=Etc/GMT+0
command: [
"postgres",
"-c",
"${POSTGRES_CUSTOM_ARGS}"
]
db-load:
build: ./scripts
image: "postgres-db-loader:latest"
container_name: postgres-db-loader
volumes:
- type: bind
source: ${POSTGRES_DDL_DIR}
target: /ddl/
- type: bind
source: ${POSTGRES_DML_DIR}
target: /dml/
- type: bind
source: ${POSTGRES_CSV_DIR}
target: /data/
depends_on:
- postgres-db
command: sh -c "/wait && python3 -u home/load.py --POSTGRES_CSV_DIR ${POSTGRES_CSV_DIR} --is_container True"
environment:
- POSTGRES_HOST=postgres-db
- POSTGRES_DATABASE=${POSTGRES_DATABASE}
- POSTGRES_USER=${POSTGRES_USER}
- POSTGRES_PASSWORD=${POSTGRES_PASSWORD}
- POSTGRES_PORT=${POSTGRES_PORT}
- WAIT_HOSTS=postgres-db:${POSTGRES_PORT}
- WAIT_TIMEOUT=300
- WAIT_SLEEP_INTERVAL=5
- WAIT_HOST_CONNECT_TIMEOUT=30
- tz=Etc/GMT+0