Repository navigation
Expand file tree
/
Copy pathdocker-compose.yml
More file actions
47 lines (44 loc) · 1.9 KB
/
Copy pathdocker-compose.yml
File metadata and controls
47 lines (44 loc) · 1.9 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
# Runs the app together with a MongoDB database. Either with the image that CI publishes for every version tag:
# docker compose pull && docker compose up -d
# or built from this checkout:
# docker compose up -d --build
# The app is then available on http://localhost:8080 (or APP_PORT). Settings can be put into a .env file next to
# this file, see .env.example.
services:
app:
image: ghcr.io/j4velin/contractsmanagementsystem:${APP_VERSION:-latest}
build: .
restart: unless-stopped
depends_on:
mongo:
condition: service_healthy
ports:
- "${APP_PORT:-8080}:8080"
environment:
SPRING_MONGODB_URI: mongodb://mongo:27017/contracts
# creates the unique index on the username
SPRING_DATA_MONGODB_AUTO_INDEX_CREATION: "true"
# contracts.remember-me.key; if empty, remembered logins don't survive a restart of the app
CONTRACTS_REMEMBERME_KEY: ${REMEMBER_ME_KEY:-}
# behind a reverse proxy: use its X-Forwarded-* headers, so redirects keep https and the public host
SERVER_FORWARD_HEADERS_STRATEGY: ${FORWARD_HEADERS_STRATEGY:-native}
# time zone of the app: decides which contracts are active today and the cancel-by dates
TZ: ${TIMEZONE:-Europe/Berlin}
# maximum Java heap: plenty for a few users, and small enough for a server with 2 GB of RAM
JAVA_TOOL_OPTIONS: -Xmx${APP_MAX_HEAP:-256m}
mongo:
image: mongo:8.0
restart: unless-stopped
# MongoDB reserves about half of the RAM for its cache by default, far more than this app needs
command: ["--wiredTigerCacheSizeGB", "${MONGO_CACHE_GB:-0.25}"]
# not published to the host: only the app can reach the database
volumes:
- mongo-data:/data/db
healthcheck:
test: ["CMD", "mongosh", "--quiet", "--eval", "db.adminCommand('ping').ok"]
interval: 5s
timeout: 5s
retries: 20
start_period: 10s
volumes:
mongo-data: