diff --git a/deploy/jenkins-agent/Dockerfile b/deploy/jenkins-agent/Dockerfile new file mode 100644 index 0000000..ec17d91 --- /dev/null +++ b/deploy/jenkins-agent/Dockerfile @@ -0,0 +1,6 @@ +# Trusted delivery agent: Docker CLI, Ansible, Trivy, and pip-audit. All tools are +# in the image, so recreating the container loses nothing. +FROM jenkins/inbound-agent:3395.v6e5377b_0fb_3c-3-jdk21 +USER root +RUN apt-get update && apt-get install -y --no-install-recommends python3 python3-venv openssh-client curl ca-certificates && rm -rf /var/lib/apt/lists/* && curl -fsSL https://download.docker.com/linux/static/stable/x86_64/docker-29.8.1.tgz | tar xz --strip-components=1 -C /usr/local/bin docker/docker && curl -fsSLo /tmp/trivy.tgz https://github.com/aquasecurity/trivy/releases/download/v0.75.0/trivy_0.75.0_Linux-64bit.tar.gz && echo "c6e65abddb348e25f10549df887045629cf28cc72453cd1c63acb717316b3f3f /tmp/trivy.tgz" | sha256sum -c - && tar xzf /tmp/trivy.tgz -C /usr/local/bin trivy && rm /tmp/trivy.tgz && python3 -m venv /opt/delivery && /opt/delivery/bin/pip install --no-cache-dir ansible-core==2.22.0 pip-audit==2.10.1 +USER jenkins diff --git a/deploy/jenkins-agent/compose.yaml b/deploy/jenkins-agent/compose.yaml new file mode 100644 index 0000000..c52350d --- /dev/null +++ b/deploy/jenkins-agent/compose.yaml @@ -0,0 +1,36 @@ +# Inbound Jenkins agent for the delivery stages. The Docker socket makes this +# container equivalent to host root, so only reviewed main-branch stages use its +# credentials. DOCKER_GID and JENKINS_SECRET come from an untracked .env file. +name: jenkins-agent + +services: + agent: + build: . + restart: unless-stopped + environment: + - JENKINS_URL=http://jenkins:8080 + - JENKINS_AGENT_NAME=delivery-agent + - JENKINS_SECRET=${JENKINS_SECRET} + - JENKINS_WEB_SOCKET=true + - JAVA_OPTS=-Xmx96m + group_add: + - "${DOCKER_GID}" + volumes: + - agent-data:/home/jenkins/agent + - trivy-cache:/home/jenkins/.cache/trivy + - /var/run/docker.sock:/var/run/docker.sock + networks: + - gitea-net + logging: + options: + max-size: 10m + max-file: "3" + +volumes: + agent-data: + trivy-cache: + +networks: + gitea-net: + external: true + name: gitea_gitea-net