2022-06-27 18:20:50 +00:00
|
|
|
# https://github.com/containers/podman/blob/main/contrib/podmanimage/stable/Containerfile
|
2022-10-13 11:28:01 +00:00
|
|
|
# https://hub.docker.com/r/jenkins/inbound-agent/tags
|
2022-06-27 18:20:50 +00:00
|
|
|
|
2022-01-13 11:41:17 +00:00
|
|
|
|
2024-12-19 03:05:31 +00:00
|
|
|
FROM jenkins/inbound-agent:alpine-jdk21@sha256:598ee03b9a48e49c0d3df1db9e1c897cd82726dd84bb130944148e7ead70861a
|
2022-01-13 11:41:17 +00:00
|
|
|
|
2022-10-13 11:28:01 +00:00
|
|
|
ARG BUILDUSER=jenkins
|
2022-06-27 17:16:02 +00:00
|
|
|
|
2022-01-13 11:41:17 +00:00
|
|
|
USER root
|
2022-10-13 11:28:01 +00:00
|
|
|
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 \
|
2022-10-13 11:28:01 +00:00
|
|
|
yq \
|
|
|
|
strace \
|
2023-10-02 11:20:48 +00:00
|
|
|
fuse-overlayfs \
|
2022-10-13 11:28:01 +00:00
|
|
|
podman \
|
|
|
|
buildah \
|
2023-08-11 12:31:24 +00:00
|
|
|
py-boto3 \
|
2022-10-13 11:28:01 +00:00
|
|
|
aws-cli \
|
|
|
|
trivy@edge-testing
|
2022-01-13 11:41:17 +00:00
|
|
|
|
2022-01-14 00:23:18 +00:00
|
|
|
# Trivy html template
|
2022-10-13 11:28:01 +00:00
|
|
|
ADD --chown=$BUILDUSER:$BUILDUSER html.tpl /home/$BUILDUSER
|
2022-01-14 00:23:18 +00:00
|
|
|
|
|
|
|
# Rootless podman
|
2022-10-13 11:28:01 +00:00
|
|
|
RUN mkdir -p /home/$BUILDUSER/.config/containers
|
2022-06-27 17:16:02 +00:00
|
|
|
|
2022-07-11 12:56:04 +00:00
|
|
|
ADD entrypoint.sh /usr/local/bin/entrypoint.sh
|
2022-10-13 11:28:01 +00:00
|
|
|
# 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 && \
|
2022-10-13 11:28:01 +00:00
|
|
|
chown $BUILDUSER:$BUILDUSER -R /home/$BUILDUSER
|
2022-01-13 11:41:17 +00:00
|
|
|
|
2022-01-13 23:47:45 +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-10-13 11:28:01 +00:00
|
|
|
ENV XDG_RUNTIME_DIR=/home/$BUILDUSER/agent/xdg-run
|
2024-06-25 17:10:00 +00:00
|
|
|
ENV XDG_CONFIG_HOME=/home/$BUILDUSER/.config
|
2024-06-25 16:35:37 +00:00
|
|
|
|
2024-11-04 19:43:41 +00:00
|
|
|
# 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
|
|
|
|
2024-04-15 14:51:31 +00:00
|
|
|
# Until we setup the logging and metrics pipelines in OTEL
|
|
|
|
ENV OTEL_LOGS_EXPORTER=none
|
|
|
|
ENV OTEL_METRICS_EXPORTER=none
|
|
|
|
|
2022-10-13 11:28:01 +00:00
|
|
|
USER $BUILDUSER
|
|
|
|
|
2022-07-11 12:56:04 +00:00
|
|
|
ENTRYPOINT ["/sbin/tini", "--", "/usr/local/bin/entrypoint.sh"]
|