-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcompose.yaml
More file actions
79 lines (76 loc) · 2.13 KB
/
compose.yaml
File metadata and controls
79 lines (76 loc) · 2.13 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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
services:
postgres:
image: postgres:17
container_name: ${PACKAGE_NAME:-knowledge-capsule}-postgres
profiles:
- prod
- dev
- db
environment:
POSTGRES_USER: ${POSTGRES_USER:-knowledge}
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD:-knowledge}
POSTGRES_DB: ${POSTGRES_DB:-knowledge}
ports:
- "5432:5432"
volumes:
- postgres_data:/var/lib/postgresql/data
healthcheck:
test: ["CMD-SHELL", "pg_isready -U ${POSTGRES_USER:-knowledge} -d ${POSTGRES_DB:-knowledge}"]
interval: 5s
timeout: 5s
retries: 5
# Production server
api:
container_name: ${PACKAGE_NAME}-prod
image: ${DOCKER_USERNAME}/${PACKAGE_NAME}:${PACKAGE_VERSION}
profiles:
- prod
build:
context: .
dockerfile: Dockerfile
ports:
- "8080:${PORT:-8080}"
env_file:
- .env
environment:
GO_ENV: production
DATABASE_URL: postgres://${POSTGRES_USER:-knowledge}:${POSTGRES_PASSWORD:-knowledge}@postgres:5432/${POSTGRES_DB:-knowledge}?sslmode=disable
command: ["./server"]
restart: always
volumes:
- prod_uploads:/app/uploads
depends_on:
postgres:
condition: service_healthy
healthcheck:
test: ["CMD-SHELL", "curl -f http://localhost:${PORT:-8080}/health || exit 1"]
interval: 5s
timeout: 5s
retries: 5
# Development server with live reload
api-dev:
container_name: ${PACKAGE_NAME}-dev
image: ${DOCKER_USERNAME}/${PACKAGE_NAME}-dev:${PACKAGE_VERSION}
profiles:
- dev
build:
context: .
dockerfile: Dockerfile.dev # separate Dockerfile for Air
ports:
- "8081:${PORT:-8080}" # map dev to a different port
env_file:
- .env
environment:
GO_ENV: development
DATABASE_URL: postgres://${POSTGRES_USER:-knowledge}:${POSTGRES_PASSWORD:-knowledge}@postgres:5432/${POSTGRES_DB:-knowledge}?sslmode=disable
command: ["air", "-c", ".air.toml"]
restart: unless-stopped
volumes:
- .:/app
- ./uploads:/app/uploads
depends_on:
postgres:
condition: service_healthy
volumes:
postgres_data:
prod_uploads: