Switch branches/tags
Nothing to show
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
76 lines (63 sloc) 3.21 KB
# Usage
# export JENKINS_USER="jenkins"
# docker run --restart=on-failure:10 -d --name=${JENKINS_USER} -p 8080:8080 -p 50000:50000 -v /home/${JENKINS_USER}:/var/jenkins_home ska-sa-cbf/${JENKINS_USER}
FROM java:openjdk-8-jdk
LABEL maintainer="Mpho Mphego <>"
ARG DEBIAN_FRONTEND=noninteractive
# RUN echo 'debconf debconf/frontend select Noninteractive' | debconf-set-selections
COPY apt-requirements.txt /
RUN apt-get update && \
apt-get install -y --no-install-recommends apt-utils && \
apt-get install -y --no-install-recommends $(grep -vE "^\s*#" apt-requirements.txt | tr "\n" " ") && \
apt-get clean && \
rm -rf /var/lib/apt/lists/* || true
# Handle python deps
RUN curl | python && \
pip install --no-cache-dir --disable-pip-version-check -U virtualenv
ENV JENKINS_HOME /var/jenkins_home
# Jenkins is ran with user `jenkins`, uid = JENKINS_UID
# If you bind mount a volume from host/volume from a data container,
# ensure you use same uid
RUN useradd -d "${JENKINS_HOME}" -u "${JENKINS_UID}" -m -s /bin/bash jenkins
## Allow jenkins user to use sudo to perform a limited subset of commands
# without a password such as installing new packages.
RUN adduser jenkins sudo
COPY jenkins-apt-sudoers /etc/sudoers.d/
RUN chmod 0440 /etc/sudoers.d/jenkins-apt-sudoers
# Jenkins home directory is a volume, so configuration and build history
# can be persisted and survive image upgrades
VOLUME /var/jenkins_home
# `/usr/share/jenkins/ref/` contains all reference configuration we want
# to set on a fresh new installation. Use it to bundle additional plugins
# or config file with your custom jenkins Docker image.
RUN mkdir -p /usr/share/jenkins/ref/init.groovy.d
COPY init.groovy /usr/share/jenkins/ref/init.groovy.d/tcp-slave-angent-port.groovy
# Copy in local config files
# COPY /usr/local/bin/
# COPY /usr/local/bin/
# RUN chmod +x /usr/share/jenkins/ref/init.groovy.d/tcp-slave-agent-port.groovy \
# && chmod +x /usr/local/bin/ \
# && chmod +x /usr/local/bin/ \
# && chmod +x /usr/local/bin/
# Jenkins Mirrors:
# LTS version
RUN bash -c "ping -c 5"
# Backup links
# -----------------------------------------
# RUN bash -c "wget '${JENKINS_VERSION}/jenkins.war' -O /usr/share/jenkins/jenkins.war"
# RUN bash -c "wget '${JENKINS_VERSION}/jenkins.war' -O /usr/share/jenkins/jenkins.war"
# -----------------------------------------
RUN wget "${JENKINS_VERSION}/jenkins.war" -O /usr/share/jenkins/jenkins.war
#RUN axel "${JENKINS_VERSION}/jenkins.war" -o /usr/share/jenkins/jenkins.war
RUN chown -R jenkins "${JENKINS_HOME}" /usr/share/jenkins/ref
# for main web interface:
# will be used by attached slave agents:
EXPOSE 50000
USER jenkins
COPY /usr/local/bin/
#RUN chmod +x /usr/local/bin/
ENTRYPOINT ["/bin/bash", "/usr/local/bin/"]