2022-06-27 18:20:50 +00:00
|
|
|
# https://github.com/containers/podman/blob/main/contrib/podmanimage/stable/Containerfile
|
|
|
|
|
2022-08-05 23:29:48 +00:00
|
|
|
ARG BASE="4.13.2-1-alpine-jdk17-preview"
|
2022-01-13 11:41:17 +00:00
|
|
|
|
|
|
|
FROM jenkins/inbound-agent:${BASE}
|
|
|
|
|
2022-06-27 17:16:02 +00:00
|
|
|
ARG USER=jenkins
|
|
|
|
|
2022-01-13 11:41:17 +00:00
|
|
|
USER root
|
2022-06-27 18:40:57 +00:00
|
|
|
RUN apk upgrade -U --available --no-cache && apk add --no-cache \
|
2022-01-13 23:47:45 +00:00
|
|
|
tini \
|
2022-01-13 11:41:17 +00:00
|
|
|
make \
|
2022-02-03 18:29:47 +00:00
|
|
|
yq \
|
2022-06-27 17:16:02 +00:00
|
|
|
strace \
|
2022-01-13 11:41:17 +00:00
|
|
|
podman \
|
|
|
|
buildah \
|
2022-06-27 18:40:57 +00:00
|
|
|
aws-cli
|
|
|
|
|
|
|
|
RUN echo "http://dl-cdn.alpinelinux.org/alpine/edge/testing" >> /etc/apk/repositories && \
|
|
|
|
apk upgrade -U --available --no-cache && apk add --no-cache \
|
2022-01-13 11:41:17 +00:00
|
|
|
trivy
|
|
|
|
|
2022-01-14 00:23:18 +00:00
|
|
|
# Trivy html template
|
2022-07-11 11:47:24 +00:00
|
|
|
ADD --chown=$USER:$USER html.tpl /home/$USER
|
2022-01-14 00:23:18 +00:00
|
|
|
|
|
|
|
# Rootless podman
|
2022-07-11 11:47:24 +00:00
|
|
|
RUN mkdir -p /home/$USER/.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-07-11 11:47:24 +00:00
|
|
|
ADD --chown=$USER:$USER conf/containers.conf conf/registries.conf conf/storage.conf /home/$USER/.config/containers
|
2022-01-13 11:41:17 +00:00
|
|
|
|
2022-07-11 11:47:24 +00:00
|
|
|
RUN echo -e "$USER:1:999\n$USER:1001:64535" > /etc/subuid && \
|
2022-06-27 18:20:50 +00:00
|
|
|
echo -e "$USER:1:999\n$USER:1001:64535" > /etc/subgid && \
|
2022-07-11 11:47:24 +00:00
|
|
|
cd /usr/bin && ln -s podman docker && \
|
|
|
|
chown $USER:$USER -R /home/$USER
|
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-07-11 12:56:04 +00:00
|
|
|
ENV XDG_RUNTIME_DIR=/home/$USER/agent/xdg-run
|
2022-07-11 13:31:03 +00:00
|
|
|
ENV BUILDAH_ISOLATION=chroot
|
2022-06-27 17:16:02 +00:00
|
|
|
ENV _CONTAINERS_USERNS_CONFIGURED=""
|
2022-01-14 00:23:18 +00:00
|
|
|
ENV TRIVY_TEMPLATE="@/home/jenkins/html.tpl"
|
|
|
|
|
2022-06-27 18:40:57 +00:00
|
|
|
USER $USER
|
2022-01-13 11:41:17 +00:00
|
|
|
|
2022-07-11 12:56:04 +00:00
|
|
|
ENTRYPOINT ["/sbin/tini", "--", "/usr/local/bin/entrypoint.sh"]
|