-
Notifications
You must be signed in to change notification settings - Fork 59
/
docker-compose.yaml
79 lines (75 loc) · 3.1 KB
/
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
name: codingstyle
services:
jenkins:
container_name: codingstyle-jenkins
build:
context: docker/images/jenkins-controller
args:
- CURRENT_UID=${CURRENT_UID}
- CURRENT_GID=${CURRENT_GID}
image: codingstyle/jenkins-controller
volumes:
- ./docker/volumes/jenkins-home:/var/jenkins_home # Mounts the local jenkins_home volume to the /var/jenkins_home path inside the container
- agent-ssh-dir:/ssh-dir # Mounts the shared volume agent-ssh-dir to a path inside the container
ports:
- 8080:8080 # Jenkins UI - HOST:CONTAINER
environment:
- TRY_UPGRADE_IF_NO_MARKER=true
- JAVA_OPTS= -Dstapler.jelly.noCache=true -Dhudson.remoting.ClassFilter=com.google.common.collect.ImmutableListMultimap -DexecutableWar.jetty.disableCustomSessionIdCookieName=true -DexecutableWar.jetty.sessionIdCookieName=codingstyle
user: ${CURRENT_USER}
restart: unless-stopped
depends_on:
key-generator:
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
key-generator:
container_name: codingstyle-key-generator
build:
context: docker/images/key-generator
image: codingstyle/key-generator
stdin_open: true
tty: true
# The entrypoint script generates the SSH keys and outputs them to the /ssh-dir directory.
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
# The healthcheck command checks if the conductor_ok file exists in the /ssh-dir directory.
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
java-agent:
container_name: codingstyle-java-agent
build:
context: docker/images/java-agent
args:
- CURRENT_UID=${CURRENT_UID}
- CURRENT_GID=${CURRENT_GID}
image: codingstyle/java-agent
depends_on:
key-generator:
condition: service_completed_successfully # Depends on the successful completion of the sidekick_service
jenkins:
condition: service_started
restart: unless-stopped
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
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:
agent-ssh-dir:
name: codingstyle-agent-ssh-dir # Creates a named volume called agent-ssh-dir
jenkins_home:
name: codingstyle-jenkins-home # Creates a named volume called jenkins-home
external: true