jenkins-podman/Dockerfile

46 lines
1.4 KiB
Docker
Raw Normal View History

2022-01-13 11:41:17 +00:00
ARG BASE="latest-alpine-jdk11"
FROM jenkins/inbound-agent:${BASE}
USER root
RUN echo "http://dl-cdn.alpinelinux.org/alpine/edge/testing" >> /etc/apk/repositories \
&& apk upgrade -U -a \
&& apk --no-cache add \
tini \
2022-01-13 11:41:17 +00:00
make \
fuse-overlayfs \
podman \
buildah \
aws-cli \
trivy
# Podman tweaks
ADD conf/containers.conf conf/registries.conf conf/storage.conf /etc/containers/
ADD --chown=jenkins:jenkins conf/podman-containers.conf /home/jenkins/.config/containers/containers.conf
RUN mkdir -p /var/lib/shared/overlay-images /var/lib/shared/overlay-layers \
/var/lib/shared/vfs-images /var/lib/shared/vfs-layers && \
touch /var/lib/shared/overlay-images/images.lock /var/lib/shared/overlay-layers/layers.lock \
/var/lib/shared/vfs-images/images.lock /var/lib/shared/vfs-layers/layers.lock
# Trivy html template
2022-01-13 14:31:35 +00:00
ADD --chown=jenkins:jenkins html.tpl /home/jenkins
2022-01-13 11:41:17 +00:00
# Patch jenkins-agent to launch podman service
RUN sed -i -e 's/exec \$JAVA_BIN/podman system service -t0\&\n exec \$JAVA_BIN/' /usr/local/bin/jenkins-agent
2022-01-13 11:41:17 +00:00
# Make docker in Jenkinsfiles work
RUN ln -s /usr/bin/podman /usr/bin/docker
# Rootless podman
RUN echo jenkins:100000:65536 > /etc/subuid \
&& echo jenkins:100000:65536 > /etc/subgid
2022-01-13 13:56:54 +00:00
ENV BUILDAH_ISOLATION=chroot
2022-01-13 11:41:17 +00:00
# Allow container layers to be stored in PVCs
VOLUME /home/jenkins/.local/share/containers
USER jenkins
ENTRYPOINT ["/sbin/tini", "--", "/usr/local/bin/jenkins-agent"]