-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathdocker-compose.yml
More file actions
90 lines (86 loc) · 2.04 KB
/
docker-compose.yml
File metadata and controls
90 lines (86 loc) · 2.04 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
services:
postgres:
image: postgres:16-alpine
container_name: postgres
user: postgres
restart: on-failure:5
environment:
POSTGRES_DB_FILE: /run/secrets/postgres_db
POSTGRES_USER_FILE: /run/secrets/postgres_user
POSTGRES_PASSWORD_FILE: /run/secrets/postgres_password
ports:
- "5432:5432"
volumes:
- postgres-data:/var/lib/postgresql/data
healthcheck:
test: [ "CMD-SHELL", "pg_isready -U postgres" ]
interval: 10s
timeout: 5s
retries: 5
secrets:
- postgres_db
- postgres_user
- postgres_password
networks:
- ctf-network
deploy:
resources:
limits:
cpus: '0.5'
memory: 256M
security_opt:
- no-new-privileges:true
read_only: true
tmpfs:
- /tmp:exec,mode=1777
- /run/postgresql:mode=1777
app:
build: .
container_name: security-ctf
user: 1000:1000
restart: on-failure:5
depends_on:
postgres:
condition: service_healthy
ports:
- "8080:8080"
environment:
SPRING_DATASOURCE_URL: jdbc:postgresql://postgres:5432/ctfdb
SPRING_DATASOURCE_USERNAME_FILE: /run/secrets/postgres_user
SPRING_DATASOURCE_PASSWORD_FILE: /run/secrets/postgres_password
healthcheck:
test: [ "CMD", "curl", "-f", "http://localhost:8080/actuator/health" ]
interval: 30s
timeout: 10s
retries: 3
start_period: 40s
secrets:
- postgres_user
- postgres_password
networks:
- ctf-network
deploy:
resources:
limits:
cpus: '1.0'
memory: 512M
security_opt:
- no-new-privileges:true
read_only: true
tmpfs:
- /tmp:exec,mode=1777
volumes:
- /tmp/spring-boot-tmp:/tmp/spring-boot-tmp
volumes:
postgres-data:
driver: local
networks:
ctf-network:
driver: bridge
secrets:
postgres_db:
file: ./secrets/postgres_db.txt
postgres_user:
file: ./secrets/postgres_user.txt
postgres_password:
file: ./secrets/postgres_password.txt