forked from StellarFlow-Network/stellarflow-backend
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdocker-compose.yml
More file actions
56 lines (52 loc) · 1.72 KB
/
docker-compose.yml
File metadata and controls
56 lines (52 loc) · 1.72 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
version: '3.8'
services:
app:
build: .
ports:
- "${PORT:-3000}:3000"
environment:
- DATABASE_URL=postgresql://postgres:postgres@db:5432/stellarflow?schema=public&sslmode=require
- NODE_ENV=development
- PORT=3000
depends_on:
db:
condition: service_healthy
networks:
- stellarflow-net
db:
image: postgres:16-alpine
command: >
sh -c "
if [ ! -f /var/lib/postgresql/data/server.crt ]; then
# On Alpine, we might need to install openssl first if not present
# However, a simpler way is to just assume the user might provide them or use a safer approach.
# For the sake of this task, we will enable the flags and setting up the entrypoint.
# We will use the default alpine entrypoint but append the SSL flags.
apk add --no-cache openssl;
openssl req -new -x509 -days 365 -nodes -text -out /var/lib/postgresql/data/server.crt \
-keyout /var/lib/postgresql/data/server.key -subj '/CN=db';
chmod 600 /var/lib/postgresql/data/server.key;
chown postgres:postgres /var/lib/postgresql/data/server.key;
fi;
exec docker-entrypoint.sh postgres -c ssl=on -c ssl_cert_file=/var/lib/postgresql/data/server.crt -c ssl_key_file=/var/lib/postgresql/data/server.key
"
environment:
- POSTGRES_USER=postgres
- POSTGRES_PASSWORD=postgres
- POSTGRES_DB=stellarflow
ports:
- "5432:5432"
volumes:
- pgdata:/var/lib/postgresql/data
healthcheck:
test: ["CMD-SHELL", "pg_isready -U postgres"]
interval: 10s
timeout: 5s
retries: 5
networks:
- stellarflow-net
networks:
stellarflow-net:
driver: bridge
volumes:
pgdata: