-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcompose.yml
More file actions
44 lines (43 loc) · 1.22 KB
/
Copy pathcompose.yml
File metadata and controls
44 lines (43 loc) · 1.22 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
services:
db:
image: postgres:18
# I'll make these so that they won't restart automatically
# so you guys won't accidentally have my solution running on your machines
# for infinity :) If this was supposed to be used running on a production server,
# you would probably want to set these to 'always' or 'unless-stopped'
restart: no
ports:
- ${DATABASE_PORT}:5432
volumes:
- pgdata:/var/lib/postgresql
env_file:
- .env
environment:
POSTGRES_USER: ${DATABASE_USER}
POSTGRES_PASSWORD: ${DATABASE_PASSWORD}
POSTGRES_DB: ${DATABASE_NAME}
healthcheck:
test: ["CMD-SHELL", "pg_isready -U ${DATABASE_USER} -d ${DATABASE_NAME}"]
interval: 5s
timeout: 5s
retries: 5
app:
restart: no
build:
context: .
depends_on:
db:
condition: service_healthy
ports:
- "${APP_PORT}:3000"
env_file:
- .env
environment:
DATABASE_HOST: db
# For linux host machines to access host services from inside Docker containers.
# A quick solution if you don't want to deal with Docker networking for now.
extra_hosts:
- "host.docker.internal:host-gateway"
volumes:
pgdata:
driver: local