-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdocker-compose.yml
More file actions
89 lines (84 loc) · 2.49 KB
/
docker-compose.yml
File metadata and controls
89 lines (84 loc) · 2.49 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
# Production deployment configuration using pre-built image
# Prerequisites: Image must be available at ghcr.io/websoft9/apprun:latest
# Usage: docker compose up -d
#
# Environment Variables (all have defaults):
# - APP_HTTP_PORT (default: 8080)
# - APP_HTTPS_PORT (default: 8443)
# - POSTGRES_PASSWORD (default: postgres, CHANGE IN PRODUCTION!)
# - POSTGRES_DB (default: apprun)
# - SSL_CERT_PATH (optional, for HTTPS)
# - SSL_KEY_PATH (optional, for HTTPS)
services:
app:
image: ghcr.io/websoft9/apprun:latest
container_name: apprun-app
restart: always
ports:
- "${APP_HTTP_PORT:-8080}:8080"
- "${APP_HTTPS_PORT:-8443}:8443"
environment:
- SERVER_ENV=production
- POSTGRES_HOST=postgres
- POSTGRES_PORT=5432
- POSTGRES_USER=${POSTGRES_USER:-apprun}
- POSTGRES_PASSWORD=${POSTGRES_PASSWORD:-postgres}
- POSTGRES_DB=${POSTGRES_DB:-apprun}
- REDIS_HOST=redis
- REDIS_PORT=6379
- REDIS_PASSWORD=${REDIS_PASSWORD:-}
- SSL_CERT_FILE=${SSL_CERT_FILE:-}
- SSL_KEY_FILE=${SSL_KEY_FILE:-}
volumes:
- ${SSL_CERT_PATH:-/dev/null}:/etc/ssl/certs/server.crt:ro
- ${SSL_KEY_PATH:-/dev/null}:/etc/ssl/private/server.key:ro
depends_on:
postgres:
condition: service_healthy
redis:
condition: service_healthy
healthcheck:
test: ["CMD", "wget", "--no-verbose", "--tries=1", "--spider", "http://localhost:8080/health"]
interval: 30s
timeout: 10s
retries: 3
start_period: 40s
networks:
- apprun-prod
postgres:
image: postgres:15-alpine
container_name: apprun-postgres
restart: always
environment:
POSTGRES_USER: ${POSTGRES_USER:-apprun}
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD:-postgres}
POSTGRES_DB: ${POSTGRES_DB:-apprun}
volumes:
- postgres_prod_data:/var/lib/postgresql/data
healthcheck:
test: ["CMD-SHELL", "pg_isready -U ${POSTGRES_USER:-apprun}"]
interval: 10s
timeout: 5s
retries: 5
networks:
- apprun-prod
redis:
image: redis:7-alpine
container_name: apprun-redis
restart: always
command: redis-server --appendonly yes ${REDIS_PASSWORD:+--requirepass ${REDIS_PASSWORD}}
volumes:
- redis_prod_data:/data
healthcheck:
test: ["CMD", "redis-cli", "ping"]
interval: 10s
timeout: 5s
retries: 5
networks:
- apprun-prod
volumes:
postgres_prod_data:
redis_prod_data:
networks:
apprun-prod:
driver: bridge