32 lines
1.3 KiB
Docker
32 lines
1.3 KiB
Docker
# Trusted Jenkins delivery agent for Chapter 6.
|
|
# Build context is the repository root (see agent/compose.yaml).
|
|
FROM jenkins/inbound-agent:latest-jdk21
|
|
|
|
USER root
|
|
|
|
# Python 3 + venv for tests, pip-audit and Ansible; curl for checks
|
|
RUN apt-get update \
|
|
&& apt-get install -y --no-install-recommends python3 python3-venv python3-pip ca-certificates curl \
|
|
&& rm -rf /var/lib/apt/lists/*
|
|
|
|
# Docker CLI + buildx plugin (client only; the daemon is the host's, via the mounted socket)
|
|
COPY --from=docker:cli /usr/local/bin/docker /usr/local/bin/docker
|
|
COPY --from=docker/buildx-bin /buildx /usr/libexec/docker/cli-plugins/docker-buildx
|
|
|
|
# Trivy scanner (image vulnerabilities + secret scanning)
|
|
COPY --from=aquasec/trivy:latest /usr/local/bin/trivy /usr/local/bin/trivy
|
|
|
|
# Ansible in its own virtual environment, plus the community.docker collection
|
|
ENV ANSIBLE_COLLECTIONS_PATH=/opt/ansible-collections
|
|
COPY ansible/requirements.yml /tmp/ansible-requirements.yml
|
|
RUN python3 -m venv /opt/ansible-venv \
|
|
&& /opt/ansible-venv/bin/pip install --no-cache-dir ansible-core \
|
|
&& /opt/ansible-venv/bin/ansible-galaxy collection install -r /tmp/ansible-requirements.yml -p /opt/ansible-collections \
|
|
&& rm /tmp/ansible-requirements.yml
|
|
|
|
# pip-audit in a separate tools venv
|
|
RUN python3 -m venv /opt/tools-venv \
|
|
&& /opt/tools-venv/bin/pip install --no-cache-dir pip-audit
|
|
|
|
USER jenkins
|