-
Notifications
You must be signed in to change notification settings - Fork 6
/
Dockerfile
62 lines (47 loc) · 1.84 KB
/
Dockerfile
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
## Jenkins Base Image
FROM jenkins/jenkins:alpine as base
MAINTAINER Justin Menga <[email protected]>
LABEL application=jenkins
# Change to root user
USER root
# Used to set the docker group ID
ARG TIMEZONE=America/Los_Angeles
COPY src/build/ /build/
# Install system requirements
RUN apk add --no-cache --virtual build-dependencies python-dev openssl-dev libffi-dev musl-dev git gcc tzdata && \
apk add --no-cache --update py-pip docker make curl git jq su-exec && \
cp /usr/share/zoneinfo/${TIMEZONE} /etc/localtime && \
echo "${TIMEZONE}" > /etc/timezone && \
pip install --no-cache-dir -r /build/requirements.txt && \
apk del build-dependencies && \
rm -rf /build
# Set default DOCKER_GID
ENV DOCKER_GID=0
# Entrypoint
COPY src/entrypoint.sh /usr/local/bin/entrypoint.sh
RUN chmod +x /usr/local/bin/entrypoint.sh
ENTRYPOINT ["/usr/local/bin/entrypoint.sh"]
### Jenkins Server Image
FROM base as jenkins
# Change to jenkins user
USER jenkins
# Add Jenkins plugins
RUN /usr/local/bin/install-plugins.sh github dockerhub-notification workflow-aggregator zentimestamp swarm blueocean ansible ansicolor
# Add Jenkins init files
COPY src/jenkins/ /usr/share/jenkins/ref/
# Default command
CMD ["/sbin/tini","--","/usr/local/bin/jenkins.sh"]
# Change to root so that we can set Docker GID on container startup
USER root
### Jenkins Slave Image
FROM base as slave
# Install Jenkins Swarm Client
ARG JENKINS_SLAVE_VERSION
RUN curl --create-dirs -fsSLo /usr/share/jenkins/slave.jar https://repo.jenkins-ci.org/releases/org/jenkins-ci/plugins/swarm-client/${JENKINS_SLAVE_VERSION:-3.9}/swarm-client-${JENKINS_SLAVE_VERSION:-3.9}.jar
WORKDIR /usr/share/jenkins
USER jenkins
# Default command
COPY src/slave.sh /usr/local/bin/slave.sh
CMD ["sh","/usr/local/bin/slave.sh"]
# Change to root so that we can set Docker GID on container startup
USER root