-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdocker-compose.yml
More file actions
96 lines (90 loc) · 3.34 KB
/
docker-compose.yml
File metadata and controls
96 lines (90 loc) · 3.34 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
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
services:
# ---------- Postgres DB ----------
database:
image: postgres:17.3
platform: linux/amd64
restart: unless-stopped
environment:
POSTGRES_DB: ${POSTGRES_DB:-checkout}
POSTGRES_USER: ${POSTGRES_USER:-checkout}
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD:-checkout}
ports:
- "${PG_HOST_PORT:-5432}:5432" # host:container (override with PG_HOST_PORT)
volumes:
- db:/var/lib/postgresql/data
- ./initdb:/docker-entrypoint-initdb.d:ro
command: ["postgres", "-c", "log_statement=all", "-c", "log_destination=stderr"]
healthcheck:
test: ["CMD-SHELL", "pg_isready -U \"$${POSTGRES_USER}\" -d \"$${POSTGRES_DB}\" -h 127.0.0.1 || exit 1"]
interval: 10s
timeout: 3s
retries: 30
profiles: ["postgres"]
# ---------- Checkout app (Postgres) ----------
checkout:
# (A) Or build locally from the Dockerfile
#build:
# context: .
# dockerfile: Dockerfile
# args:
# SERVICE: checkout
# VERSION_TAG: ${VERSION_TAG:-dev}
#image: checkout:${VERSION_TAG:-dev}
# (B) Use a prebuilt image (recommended if you're testing images built with CI)
# Comment out (A) block and uncomment the line below
image: ${APP_IMAGE:-checkout}:${APP_TAG:-latest}
depends_on:
database:
condition: service_healthy
restart: unless-stopped
command: ["run"]
environment:
CHECKOUT_DB_HOST: database # reference postgres host
CHECKOUT_DB_PORT: ${PG_HOST_PORT:-5432} # DB port
CHECKOUT_DB_USER: ${POSTGRES_USER:-checkout} # App auth password
CHECKOUT_DB_PASSWORD: ${POSTGRES_PASSWORD:-checkout} # DB password (make sure it matches $POSTGRES_PASSWORD)
CHECKOUT_LOG_LEVEL: debug # debug logging for testing
CHECKOUT_LOG_FORMAT: text # format logs (alternative: 'json')
CHECKOUT_PASSWORD: ${PASSWORD:-1234} # change password if required
ports:
- "${APP_PORT:-8080}:8080"
healthcheck:
test: ["CMD-SHELL", "wget -qO- http://127.0.0.1:8080/health || exit 1"]
interval: 10s
timeout: 3s
retries: 30
profiles: ["postgres"]
# ---------- Checkout app (SQLite) ----------
checkout-sqlite:
# (A) Or build locally from the Dockerfile
#build:
# context: .
# dockerfile: Dockerfile
# args:
# SERVICE: checkout
# VERSION_TAG: ${VERSION_TAG:-dev}
#image: checkout:${VERSION_TAG:-dev}
# (B) Use a prebuilt image (recommended if you're testing images built with CI)
# Comment out (A) block and uncomment the line below
image: ${APP_IMAGE:-checkout}:${APP_TAG:-latest}
restart: unless-stopped
command: ["run"]
# If you want to use CLI flags instead of env, uncomment and pass them:
# command: ["run", "--sqlite", "/data/db", "--log-level", "${LOG_LEVEL:-debug}", "--password", "${AUTH_PASSWORD:-1234}"]
environment:
CHECKOUT_SQLITE: /data/checkout.db
CHECKOUT_MEMORY_DB: "false"
CHECKOUT_RECREATE_SCHEMA: "true"
volumes:
- appdata:/data
ports:
- "${APP_PORT:-8080}:8080"
healthcheck:
test: ["CMD-SHELL", "wget -qO- http://127.0.0.1:8080/health || exit 1"]
interval: 10s
timeout: 3s
retries: 30
profiles: ["sqlite"]
volumes:
db:
appdata: