-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdocker-compose.yaml
41 lines (40 loc) · 915 Bytes
/
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
services:
server:
build:
context: .
dockerfile: Dockerfile
tty: true
environment:
DB_HOST: ${DB_HOST:-db}
DB_USER: ${DB_USER:-postgres}
DB_PASSWORD: ${DB_PASSWORD:-postgres}
DB_NAME: ${DB_NAME:-postgres}
DB_PORT: ${DB_PORT:-5432}
env_file:
- .env
restart: always
ports:
- 8001:8001
depends_on:
- db
extra_hosts:
- 'host.docker.internal:host-gateway'
command: go run cmd/api/main.go
volumes:
- .:/code
db:
image: postgres:alpine
environment:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
POSTGRES_DB: postgres
command: postgres -c log_statement=all
volumes:
- postgres-data:/var/lib/postgresql/data
healthcheck:
test: ["CMD-SHELL", "pg_isready -U $$POSTGRES_USER"]
interval: 10s
timeout: 5s
retries: 5
volumes:
postgres-data: