{"id":27243816,"url":"https://github.com/mateusz-lisowski/jenkins-stencil","last_synced_at":"2026-05-05T22:37:17.424Z","repository":{"id":286171628,"uuid":"960600262","full_name":"mateusz-lisowski/jenkins-stencil","owner":"mateusz-lisowski","description":"Jenkins stencil setup with docker and docker-compose.","archived":false,"fork":false,"pushed_at":"2025-04-09T23:22:43.000Z","size":10,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-04-10T20:58:45.961Z","etag":null,"topics":["docker","docker-compose","jenkins"],"latest_commit_sha":null,"homepage":"","language":"Dockerfile","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/mateusz-lisowski.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2025-04-04T18:03:28.000Z","updated_at":"2025-04-09T23:35:44.000Z","dependencies_parsed_at":"2025-04-10T00:26:45.558Z","dependency_job_id":null,"html_url":"https://github.com/mateusz-lisowski/jenkins-stencil","commit_stats":null,"previous_names":["mateusz-lisowski/jenkins-tutorial","mateusz-lisowski/jenkins-stencil"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mateusz-lisowski%2Fjenkins-stencil","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mateusz-lisowski%2Fjenkins-stencil/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mateusz-lisowski%2Fjenkins-stencil/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mateusz-lisowski%2Fjenkins-stencil/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mateusz-lisowski","download_url":"https://codeload.github.com/mateusz-lisowski/jenkins-stencil/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248298417,"owners_count":21080318,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["docker","docker-compose","jenkins"],"created_at":"2025-04-10T20:58:48.507Z","updated_at":"2026-05-05T22:37:17.393Z","avatar_url":"https://github.com/mateusz-lisowski.png","language":"Dockerfile","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Jenkins with Docker Agent (Docker-in-Docker) Setup\n\nThis repository provides a ready-to-run Jenkins environment using Docker Compose. It's specifically configured to enable Jenkins pipelines to utilize Docker agents via a Docker-in-Docker (DinD) setup.\n\nThis allows you to define pipeline stages that run inside specific Docker containers, providing clean, isolated, and reproducible build environments.\n\n## Features\n\n*   **Docker Compose:** Orchestrates the Jenkins controller and Docker-in-Docker services.\n*   **Custom Jenkins Image:** Builds upon the official Jenkins LTS image (`jenkins/jenkins:2.492.3-jdk17`) and installs:\n    *   Docker CLI (`docker-ce-cli`) - To communicate with the DinD service.\n    *   Essential Jenkins plugins: `blueocean` and `docker-workflow`.\n*   **Docker-in-Docker (DinD):** A dedicated service (`jenkins-docker`) running `docker:dind` allows the Jenkins controller to spawn sibling Docker containers for pipeline agents.\n*   **Secure Connection:** Uses TLS to secure the connection between the Jenkins controller and the DinD service.\n*   **Persistent Data:** Uses named Docker volumes (`jenkins-data`, `jenkins-docker-certs`) to persist Jenkins configuration, job data, and TLS certificates across container restarts.\n*   **Sample Pipeline:** Includes a `Jenkinsfile.groovy` demonstrating a basic pipeline using a `python:alpine` Docker agent.\n\n## Prerequisites\n\n*   Docker\n*   Docker Compose\n\n## Getting Started\n\n### 1. Clone the repository:\n\n```bash\ngit clone jenkins-stencil\ncd jenkins-stencil\n```\n\n### 2. Build and start the services\n\n```bash\ndocker compose up -d --build\n```\n*   `--build`: Ensures the custom `jenkins-server` image is built using the `Dockerfile`.\n*   `-d`: Runs the containers in detached mode (in the background).\n\n### 3. Access Jenkins:\n\nOpen your web browser and navigate to `http://localhost:8080`.\nJenkins needs an initial admin password to unlock. You can retrieve it by running:\n```bash\ndocker compose exec jenkins-server cat /var/jenkins_home/secrets/initialAdminPassword\n```\nCopy the password from the terminal and paste it into the Jenkins setup wizard.\nFollow the on-screen instructions to complete the initial setup (you can choose \"Install suggested plugins\" or select your own, though the essential ones are already included).\n\n### 4. Create a Pipeline Job:\n*   Once Jenkins is running, create a new item.\n*   Choose \"Pipeline\" and give it a name (e.g., \"Docker Agent Test\").\n*   In the job configuration, scroll down to the \"Pipeline\" section.\n*   Select \"Pipeline script from SCM\" from the Definition dropdown.\n*   Choose \"Git\" as the SCM.\n*   Enter the Repository URL (if you pushed this repo to Git) or simply change the Definition to \"Pipeline script\" and paste the content of `Jenkinsfile.groovy` into the text area for a quick test.\n*   Ensure the \"Script Path\" is `Jenkinsfile.groovy` (the default).\n*   Save the job.\n\n### 5. Run the Pipeline\n*   Click \"Build Now\" on the pipeline job page.\n*   Observe the console output. You should see Jenkins pulling the `python:alpine` image (if not already present) and executing the steps defined in the `Jenkinsfile.groovy` inside that container.\n\n## File Structure\n\n*   `README.md`: This file.\n*   `compose.yaml`: Defines the Docker Compose services (`jenkins-server`, `jenkins-docker`), networks, and volumes.\n*   `./jenkins/Dockerfile`: Defines the custom `jenkins-server` image, installing necessary tools and plugins.\n*   `./jenkins/Jenkinsfile.groovy`: A sample declarative pipeline demonstrating the use of a Docker agent.\n\n## Stopping and Cleaning Up\n\n*   To stop the running containers:\n    ```bash\n    docker compose down\n    ```\n*   To stop the containers and remove the associated volumes (Jenkins data, certificates):\n    ```bash\n    docker compose down -v\n    ```\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmateusz-lisowski%2Fjenkins-stencil","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmateusz-lisowski%2Fjenkins-stencil","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmateusz-lisowski%2Fjenkins-stencil/lists"}