forked from algertc/ALPR-Database
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdocker-compose_dbonly.yml
32 lines (30 loc) · 945 Bytes
/
docker-compose_dbonly.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
version: "3.8"
services:
db:
image: postgres:13
restart: unless-stopped
environment:
- POSTGRES_DB=postgres
- POSTGRES_USER=postgres
- POSTGRES_PASSWORD=password # Change this to a secure password
volumes:
- db-data:/var/lib/postgresql/data
- ./schema.sql:/docker-entrypoint-initdb.d/schema.sql
- ./migrations.sql:/migrations.sql
# Make sure you download the migrations.sql file if you are updating your existing database. If you changed the user or database name, you will need to plug that in in the command below.
command: >
bash -c "
docker-entrypoint.sh postgres &
until pg_isready; do sleep 1; done;
psql -U postgres -d postgres -f /migrations.sql;
wait
"
ports:
- "5432:5432"
healthcheck:
test: ["CMD-SHELL", "pg_isready -U postgres"]
interval: 10s
timeout: 5s
retries: 5
volumes:
db-data: