From 7c4b465d8c773b2e6282e78553c7c49e85e091d5 Mon Sep 17 00:00:00 2001 From: Andrew D. France Date: Tue, 22 Jul 2025 20:49:31 -0500 Subject: Added Jenkins files for local CI testing --- Dockerfile.jenkins | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 Dockerfile.jenkins (limited to 'Dockerfile.jenkins') diff --git a/Dockerfile.jenkins b/Dockerfile.jenkins new file mode 100644 index 0000000..874941a --- /dev/null +++ b/Dockerfile.jenkins @@ -0,0 +1,29 @@ +# Dockerfile.jenkins +# Use the official Jenkins image as a base +FROM jenkins/jenkins:lts-jdk17 + +# Pass the Docker group ID from the host as a build argument +ARG DOCKER_GID + +# Switch to root user to install dependencies +USER root + +# Install Docker CLI so Jenkins can interact with the host's Docker daemon +RUN apt-get update && apt-get install -y lsb-release sudo +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 + +# Create a 'docker' group with the host's GID to match permissions +# This is the key step to prevent the container from exiting +RUN if [ -n "$DOCKER_GID" ]; then groupadd -g $DOCKER_GID docker; else groupadd -g 999 docker; fi + +# Add the 'jenkins' user to the docker group +RUN usermod -aG docker jenkins + +# Switch back to the jenkins user +USER jenkins -- cgit v1.2.3-59-g8ed1b