-
Notifications
You must be signed in to change notification settings - Fork 199
/
build-docker-compose.yaml
211 lines (211 loc) · 8.13 KB
/
build-docker-compose.yaml
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
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
services:
sidekick_service:
# Configuration for the sidekick service
build: dockerfiles/sidekick/.
stdin_open: true
tty: true
entrypoint: sh -c "/usr/local/bin/keygen.sh /ssh-dir" # Runs the keygen.sh script and specifies the output directory
volumes:
- agent-ssh-dir:/ssh-dir # Mounts the agent-ssh-dir volume to the /ssh-dir path inside the container
healthcheck:
test: ["CMD-SHELL", "[ -f /ssh-dir/conductor_ok ] || exit 1"]
# Checks if the conductor_ok file exists in the /ssh-dir path
interval: 5s
timeout: 10s
retries: 5
discovery_and_jcasc_modifier:
build: dockerfiles/agent-discovery/.
stdin_open: true
tty: true
entrypoint: sh -c "/usr/local/bin/find-name.sh"
profiles:
- maven
- python
- node
- android
- multi
- golang
- default
# This service depends on the sidekick_service (generating SSH keys and JCasc token) completing successfully.
depends_on:
sidekick_service:
condition: service_completed_successfully # Depends on the successful completion of the sidekick_service
# The healthcheck command checks if the find-name.sh script can be executed successfully.
healthcheck:
test: ["CMD-SHELL", "/usr/local/bin/find-name.sh || exit 0"]
interval: 5s
timeout: 10s
retries: 50
volumes:
- jenkins_home:/var/jenkins_home # Mounts the jenkins_home volume to the /var/jenkins_home path inside the container
- agent-ssh-dir:/ssh-dir # Mounts the agent-ssh-dir volume to the /ssh-dir path inside the container
- ./secrets/:/secrets/ # Mounts the secrets directory to the /secrets path inside the container
jenkins_controller:
build: dockerfiles/.
restart: on-failure
# The CASC_RELOAD_TOKEN environment variable is used by the Jenkins controller to restart the Configuration as Code (JCasc) plugin configuration.
environment:
- CASC_RELOAD_TOKEN=thisisnotsecure
ports:
- "8080:8080"
volumes:
- jenkins_home:/var/jenkins_home # Mounts the jenkins_home volume to the /var/jenkins_home path inside the container
- agent-ssh-dir:/ssh-dir # Mounts the agent-ssh-dir volume to the /app path inside the container
- ./secrets/jcasc_token:/run/secrets/CASC_RELOAD_TOKEN:ro
depends_on:
sidekick_service:
condition: service_completed_successfully # Depends on the successful completion of the sidekick_service
healthcheck:
test: ["CMD-SHELL", "[ -f /ssh-dir/conductor_ok ] || exit 1"]
# Checks if the conductor_ok file exists in the /ssh-dir path
interval: 5s
timeout: 10s
retries: 5
default_agent:
image: jenkins/ssh-agent:6.1.0
container_name: desktop-jenkins_agent-1
profiles:
- default
depends_on:
sidekick_service:
condition: service_completed_successfully # Depends on the successful completion of the sidekick_service
jenkins_controller:
condition: service_started
healthcheck:
test: ["CMD-SHELL", "[ -f /home/jenkins/.ssh/authorized_keys ] || exit 1"]
# Checks if the authorized_keys file exists in the /home/jenkins/.ssh path
interval: 5s
timeout: 10s
retries: 5
volumes:
- agent-ssh-dir:/home/jenkins/.ssh:ro # Mounts the agent-ssh-dir volume to the /home/jenkins/.ssh path inside the container as read-only
maven:
build: dockerfiles/maven/.
container_name: desktop-jenkins_agent-1-maven
profiles:
- maven
depends_on:
sidekick_service:
condition: service_completed_successfully # Depends on the successful completion of the sidekick_service
jenkins_controller:
condition: service_started
healthcheck:
test: ["CMD-SHELL", "[ -f /home/jenkins/.ssh/authorized_keys ] || exit 1"]
# Checks if the authorized_keys file exists in the /home/jenkins/.ssh path
interval: 5s
timeout: 10s
retries: 5
volumes:
- agent-ssh-dir:/home/jenkins/.ssh:ro # Mounts the agent-ssh-dir volume to the /home/jenkins/.ssh path inside the container as read-only
python:
build: dockerfiles/python/.
container_name: desktop-jenkins_agent-1-python
profiles:
- python
depends_on:
sidekick_service:
condition: service_completed_successfully # Depends on the successful completion of the sidekick_service
jenkins_controller:
condition: service_started
healthcheck:
test: ["CMD-SHELL", "[ -f /home/jenkins/.ssh/authorized_keys ] || exit 1"]
# Checks if the authorized_keys file exists in the /home/jenkins/.ssh path
interval: 5s
timeout: 10s
retries: 5
volumes:
- agent-ssh-dir:/home/jenkins/.ssh:ro # Mounts the agent-ssh-dir volume to the /home/jenkins/.ssh path inside the container as read-only
node:
build: dockerfiles/node/.
environment:
- GITPOD_WORKSPACE_URL=${GITPOD_WORKSPACE_URL}
container_name: desktop-jenkins_agent-1-node
profiles:
- node
depends_on:
sidekick_service:
condition: service_completed_successfully # Depends on the successful completion of the sidekick_service
jenkins_controller:
condition: service_started
ports:
- "3000:3000"
healthcheck:
test: ["CMD-SHELL", "[ -f /home/jenkins/.ssh/authorized_keys ] || exit 1"]
# Checks if the authorized_keys file exists in the /home/jenkins/.ssh path
interval: 5s
timeout: 10s
retries: 5
volumes:
- agent-ssh-dir:/home/jenkins/.ssh:ro # Mounts the agent-ssh-dir volume to the /home/jenkins/.ssh path inside the container as read-only
multi:
build: dockerfiles/multi/.
environment:
- GITPOD_WORKSPACE_URL=${GITPOD_WORKSPACE_URL}
container_name: desktop-jenkins_agent-1-multi
profiles:
- multi
depends_on:
sidekick_service:
condition: service_completed_successfully # Depends on the successful completion of the sidekick_service
jenkins_controller:
condition: service_started
ports:
- "3000:3000"
- "5000:5000"
healthcheck:
test: ["CMD-SHELL", "[ -f /home/jenkins/.ssh/authorized_keys ] || exit 1"]
# Checks if the authorized_keys file exists in the /home/jenkins/.ssh path
interval: 5s
timeout: 10s
retries: 5
volumes:
- agent-ssh-dir:/home/jenkins/.ssh:ro # Mounts the agent-ssh-dir volume to the /home/jenkins/.ssh path inside the container as read-only
android:
build: dockerfiles/android/.
environment:
- GITPOD_WORKSPACE_URL=${GITPOD_WORKSPACE_URL}
container_name: desktop-jenkins_agent-1-android
profiles:
- android
depends_on:
sidekick_service:
condition: service_completed_successfully # Depends on the successful completion of the sidekick_service
jenkins_controller:
condition: service_started
ports:
- "3000:3000"
- "5000:5000"
healthcheck:
test: ["CMD-SHELL", "[ -f /home/jenkins/.ssh/authorized_keys ] || exit 1"]
# Checks if the authorized_keys file exists in the /home/jenkins/.ssh path
interval: 5s
timeout: 10s
retries: 5
volumes:
- agent-ssh-dir:/home/jenkins/.ssh:ro # Mounts the agent-ssh-dir volume to the /home/jenkins/.ssh path inside the container as read-only
golang:
build: dockerfiles/golang/.
environment:
- GITPOD_WORKSPACE_URL=${GITPOD_WORKSPACE_URL}
container_name: desktop-jenkins_agent-1-golang
profiles:
- golang
depends_on:
sidekick_service:
condition: service_completed_successfully # Depends on the successful completion of the sidekick_service
jenkins_controller:
condition: service_started
ports:
- "3000:3000"
healthcheck:
test: ["CMD-SHELL", "[ -f /home/jenkins/.ssh/authorized_keys ] || exit 1"]
# Checks if the authorized_keys file exists in the /home/jenkins/.ssh path
interval: 5s
timeout: 10s
retries: 5
volumes:
- agent-ssh-dir:/home/jenkins/.ssh:ro # Mounts the agent-ssh-dir volume to the /home/jenkins/.ssh path inside the container as read-only
volumes:
jenkins_home: null
agent-ssh-dir:
name: agent-ssh-dir # Creates a named volume called agent-ssh-dir