-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdocker-compose.yaml
More file actions
41 lines (38 loc) · 1.01 KB
/
docker-compose.yaml
File metadata and controls
41 lines (38 loc) · 1.01 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
version: '3.8'
services:
db:
image: postgres:16-alpine
container_name: snippetbox_db
restart: unless-stopped
environment:
POSTGRES_DB: snippetbox
POSTGRES_USER: web
POSTGRES_PASSWORD: pass
ports:
- "5432:5432"
volumes:
- postgres_data:/var/lib/postgresql/data
- ./setup.sql:/docker-entrypoint-initdb.d/setup.sql
healthcheck:
test: ["CMD-SHELL", "pg_isready -U web -d snippetbox"]
interval: 10s
timeout: 5s
retries: 5
web:
build:
context: .
dockerfile: Dockerfile
container_name: snippetbox_web
restart: unless-stopped
ports:
- "8080:8080"
environment:
DB_DSN: "host=db port=5432 user=web password=pass dbname=snippetbox sslmode=disable"
ADDR: ":8080"
depends_on:
db:
condition: service_healthy
command: ["./main", "-addr=:8080", "-dsn=host=db port=5432 user=web password=pass dbname=snippetbox sslmode=disable", "-tls=false"]
volumes:
postgres_data:
driver: local