jenkins-podman/Dockerfile

57 lines
1.8 KiB
Docker
Raw Normal View History

# https://github.com/containers/podman/blob/main/contrib/podmanimage/stable/Containerfile
# https://hub.docker.com/r/jenkins/inbound-agent/tags
2022-01-13 11:41:17 +00:00
FROM jenkins/inbound-agent:alpine-jdk21@sha256:598ee03b9a48e49c0d3df1db9e1c897cd82726dd84bb130944148e7ead70861a
2022-01-13 11:41:17 +00:00
ARG BUILDUSER=jenkins
2022-06-27 17:16:02 +00:00
2022-01-13 11:41:17 +00:00
USER root
RUN echo "@edge-testing http://dl-cdn.alpinelinux.org/alpine/edge/testing" >> /etc/apk/repositories && \
apk upgrade -U --available --no-cache && \
apk add --no-cache \
tini \
make \
2023-08-08 11:06:05 +00:00
jq \
yq \
strace \
2023-10-02 11:20:48 +00:00
fuse-overlayfs \
podman \
buildah \
2023-08-11 12:31:24 +00:00
py-boto3 \
aws-cli \
trivy@edge-testing
2022-01-13 11:41:17 +00:00
2022-01-14 00:23:18 +00:00
# Trivy html template
ADD --chown=$BUILDUSER:$BUILDUSER html.tpl /home/$BUILDUSER
2022-01-14 00:23:18 +00:00
# Rootless podman
RUN mkdir -p /home/$BUILDUSER/.config/containers
2022-06-27 17:16:02 +00:00
ADD entrypoint.sh /usr/local/bin/entrypoint.sh
# conf/registries.conf will be mounted RO at runtime to inherit worker settings incl. caching proxies
ADD --chown=$BUILDUSER:$BUILDUSER conf/containers.conf conf/storage.conf /home/$BUILDUSER/.config/containers
2022-01-13 11:41:17 +00:00
2024-03-12 15:58:11 +00:00
RUN echo -e "$BUILDUSER:100000:65535" > /etc/subuid && \
echo -e "$BUILDUSER:100000:65535" > /etc/subgid && \
2022-07-11 11:47:24 +00:00
cd /usr/bin && ln -s podman docker && \
chown $BUILDUSER:$BUILDUSER -R /home/$BUILDUSER
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
ENV XDG_RUNTIME_DIR=/home/$BUILDUSER/agent/xdg-run
2024-06-25 17:10:00 +00:00
ENV XDG_CONFIG_HOME=/home/$BUILDUSER/.config
# Not needed on containerd and actually breaks `podman build`
#ENV BUILDAH_ISOLATION=chroot
#ENV _CONTAINERS_USERNS_CONFIGURED=""
2022-01-14 00:23:18 +00:00
# Until we setup the logging and metrics pipelines in OTEL
ENV OTEL_LOGS_EXPORTER=none
ENV OTEL_METRICS_EXPORTER=none
USER $BUILDUSER
ENTRYPOINT ["/sbin/tini", "--", "/usr/local/bin/entrypoint.sh"]