47 lines
1.4 KiB
Docker
47 lines
1.4 KiB
Docker
# https://github.com/containers/podman/blob/main/contrib/podmanimage/stable/Containerfile
|
|
|
|
ARG BASE="4.13-2-alpine-jdk17-preview"
|
|
|
|
FROM jenkins/inbound-agent:${BASE}
|
|
|
|
ARG USER=jenkins
|
|
|
|
USER root
|
|
RUN apk upgrade -U --available --no-cache && apk add --no-cache \
|
|
tini \
|
|
make \
|
|
yq \
|
|
strace \
|
|
podman \
|
|
buildah \
|
|
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 \
|
|
trivy
|
|
|
|
# Trivy html template
|
|
ADD --chown=$USER:$USER html.tpl /home/$USER
|
|
|
|
# Rootless podman
|
|
RUN mkdir -p /home/$USER/.config/containers
|
|
|
|
ADD entrypoint.sh /usr/local/bin/entrypoint.sh
|
|
ADD --chown=$USER:$USER conf/containers.conf conf/registries.conf conf/storage.conf /home/$USER/.config/containers
|
|
|
|
RUN echo -e "$USER:1:999\n$USER:1001:64535" > /etc/subuid && \
|
|
echo -e "$USER:1:999\n$USER:1001:64535" > /etc/subgid && \
|
|
cd /usr/bin && ln -s podman docker && \
|
|
chown $USER:$USER -R /home/$USER
|
|
|
|
# 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/$USER/agent/xdg-run
|
|
ENV _CONTAINERS_USERNS_CONFIGURED=""
|
|
ENV TRIVY_TEMPLATE="@/home/jenkins/html.tpl"
|
|
|
|
USER $USER
|
|
|
|
ENTRYPOINT ["/sbin/tini", "--", "/usr/local/bin/entrypoint.sh"]
|