Pretty basic. Following Jenkins tutorials at https://www.jenkins.io/doc/tutorials/build-a-multibranch-pipeline-project/#run-jenkins-in-docker
Created
November 18, 2021 14:51
-
-
Save gswallow/3c82150cde1840a5aca15727e4ff0080 to your computer and use it in GitHub Desktop.
Janky Jenkins Docker Setup
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
FROM jenkins/jenkins:2.303.3-jdk11 | |
USER root | |
RUN apt-get update && apt-get install -y lsb-release | |
RUN curl -fsSLo /usr/share/keyrings/docker-archive-keyring.asc \ | |
https://download.docker.com/linux/debian/gpg | |
RUN echo "deb [arch=$(dpkg --print-architecture) \ | |
signed-by=/usr/share/keyrings/docker-archive-keyring.asc] \ | |
https://download.docker.com/linux/debian \ | |
$(lsb_release -cs) stable" > /etc/apt/sources.list.d/docker.list | |
RUN apt-get update && apt-get install -y docker-ce-cli | |
USER jenkins | |
RUN jenkins-plugin-cli --plugins "blueocean:1.25.1 docker-workflow:1.26" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
TEMPDIR=$(mktemp -d) | |
for d in certs jenkins-data home; do | |
if [ ! -d ${TEMPDIR}/${d} ]; then | |
mkdir -p ${TEMPDIR}/${d} | |
fi | |
done | |
if ! docker network inspect jenkins > /dev/null 2>&1; then | |
docker network create jenkins | |
fi | |
docker run \ | |
--name jenkins-docker \ | |
--rm \ | |
--detach \ | |
--privileged \ | |
--network jenkins \ | |
--network-alias docker \ | |
--env DOCKER_TLS_CERTDIR=/certs \ | |
--volume ${TEMPDIR}/certs:/certs/client \ | |
--volume ${TEMPDIR}/jenkins-data:/var/jenkins_home \ | |
--publish 3000:3000 \ | |
--publish 2376:2376 \ | |
docker:dind \ | |
--storage-driver overlay2 | |
docker run \ | |
--name jenkins-blueocean \ | |
--rm \ | |
--detach \ | |
--network jenkins \ | |
--env DOCKER_HOST=tcp://docker:2376 \ | |
--env DOCKER_CERT_PATH=/certs/client \ | |
--env DOCKER_TLS_VERIFY=1 \ | |
--publish 8080:8080 \ | |
--publish 50000:50000 \ | |
--volume ${TEMPDIR}/certs:/certs/client:ro \ | |
--volume ${TEMPDIR}/jenkins-data:/var/jenkins_home \ | |
--volume ${TEMPDIR}/home:/home \ | |
jenkins-blueocean:1.1 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment