-
Notifications
You must be signed in to change notification settings - Fork 54
Expand file tree
/
Copy pathcompose.base.yml
More file actions
73 lines (70 loc) · 1.96 KB
/
compose.base.yml
File metadata and controls
73 lines (70 loc) · 1.96 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
services:
redis:
image: ${REDIS_IMAGE:-redis:alpine}
restart: unless-stopped
container_name: $APP_NAME-redis
volumes:
- ./redis:/data
networks:
- default
deploy:
resources:
limits:
cpus: '${REDIS_CPU_LIMIT:-0.5}'
memory: ${REDIS_MEMORY_LIMIT:-256M}
healthcheck:
test: [ "CMD", "redis-cli", "ping" ]
interval: ${HEALTHCHECK_INTERVAL:-30s}
timeout: ${HEALTHCHECK_TIMEOUT:-5s}
retries: ${HEALTHCHECK_RETRIES:-3}
start_period: ${HEALTHCHECK_START_PERIOD:-10s}
security_opt:
- no-new-privileges:true
app:
image: ${APP_IMAGE_NAME}:${APP_IMAGE_TAG}
container_name: $APP_NAME-app
build:
context: .
dockerfile: Dockerfile
args:
PYTHON_BASE: ${PYTHON_VERSION:-3.12}
NODE_BASE: ${NODE_VERSION:-18}
restart: always
env_file:
- .env
environment:
- ENVIRONMENT=${ENVIRONMENT:-docker}
- URL_PREFIX=${URL_PREFIX}
- DEBUG=${DEBUG:-false}
- TZ=${TZ:-Asia/Shanghai}
volumes:
- ./media:/project/media
- static:/project/static-dist
- ./db.sqlite3:/project/db.sqlite3
- ./log:/project/src/logs
user: "0:0"
depends_on:
redis:
condition: service_healthy
networks:
- default
ports:
- "${APP_PORT:-9876}:8000"
deploy:
resources:
limits:
cpus: '${APP_CPU_LIMIT:-1.0}'
memory: ${APP_MEMORY_LIMIT:-512M}
healthcheck:
test: [ "CMD", "python", "-c", "import requests; r = requests.get('http://localhost:${APP_INTERNAL_PORT:-8000}${URL_PREFIX}/api/django-starter/monitoring/health'); exit(0 if r.status_code == 200 else 1)" ]
interval: ${HEALTHCHECK_INTERVAL:-30s}
timeout: ${HEALTHCHECK_TIMEOUT:-5s}
retries: ${HEALTHCHECK_RETRIES:-3}
start_period: ${HEALTHCHECK_START_PERIOD:-10s}
security_opt:
- no-new-privileges:true
volumes:
static:
networks:
default:
name: $APP_NAME