-
-
Save tylerlwsmith/b5ed1924bffda354db75d29a8a784bfb to your computer and use it in GitHub Desktop.
Jenkins Docker Compose
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
JENKINS_UID=1000 | |
JENKINS_GID=1000 |
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
version: "3.9" | |
services: | |
jenkins: | |
container_name: jenkins | |
build: | |
context: . | |
dockerfile: ./Dockerfile | |
environment: | |
- DOCKER_CERT_PATH=/certs/client | |
- DOCKER_HOST=tcp://docker:2376 | |
- DOCKER_TLS_VERIFY=1 | |
ports: | |
- 8081:8080 | |
- 50000:50000 | |
volumes: | |
- jenkins_home:/var/jenkins_home | |
- jenkins-docker-certs:/certs/client:ro | |
networks: | |
- jenkins | |
depends_on: | |
- docker | |
secrets: | |
- source: public_key | |
target: /var/jenkins_home/.ssh/id_rsa.pub | |
uid: "${JENKINS_UID}" | |
gid: "${JENKINS_GID}" | |
- source: private_key | |
target: /var/jenkins_home/.ssh/id_rsa | |
uid: "${JENKINS_UID}" | |
gid: "${JENKINS_GID}" | |
docker: | |
container_name: docker | |
image: docker:20.10.7-dind | |
privileged: true | |
environment: | |
- DOCKER_TLS_CERTDIR=/certs | |
volumes: | |
- jenkins-docker-certs:/certs/client | |
- jenkins_home:/var/jenkins_home | |
networks: | |
- jenkins | |
ports: | |
- 2376:2376 | |
registry: | |
container_name: "docker-registry" | |
image: "registry:2.7.1" | |
volumes: | |
- registry:/var/lib/registry | |
volumes: | |
jenkins_home: | |
jenkins-docker-certs: | |
registry: | |
networks: | |
jenkins: | |
secrets: | |
public_key: | |
file: ~/.ssh/jenkins.pub | |
private_key: | |
file: ~/.ssh/jenkins |
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.289.2-lts-jdk11 | |
USER root | |
RUN apt-get update && apt-get install -y apt-transport-https \ | |
ca-certificates curl gnupg2 \ | |
software-properties-common | |
RUN curl -fsSL https://download.docker.com/linux/debian/gpg | apt-key add - | |
RUN apt-key fingerprint 0EBFCD88 | |
RUN add-apt-repository \ | |
"deb [arch=amd64] https://download.docker.com/linux/debian \ | |
$(lsb_release -cs) stable" | |
RUN apt-get update && apt-get install -y docker-ce-cli | |
RUN curl -L "https://github.com/docker/compose/releases/download/1.29.2/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose | |
RUN chmod +x /usr/local/bin/docker-compose | |
RUN apt-get install -y nano vim | |
USER jenkins | |
RUN jenkins-plugin-cli --plugins "blueocean:1.24.7 docker-workflow:1.26" | |
EXPOSE 8080 50000 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment