Trust github.com in container, add in possible Jenkins userIDs

pull/6816/head
Andras Fekete 2023-09-22 14:55:55 -04:00
parent f0d0a87822
commit 717249c0cc
2 changed files with 7 additions and 8 deletions

View File

@ -18,6 +18,9 @@ ARG UID=1000
ARG GID=1000
RUN groupadd -f -g ${GID} docker && ( getent passwd ${UID} || useradd -ms /bin/bash ${USER} -u ${UID} -g ${GID} )
# Add github.com as an SSH known host
RUN ssh -o StrictHostKeyChecking=no -T git@github.com; cat ~/.ssh/known_hosts >> /etc/ssh/ssh_known_hosts
# install ccache
RUN mkdir -p /opt/ccache/bin && for prog in gcc g++ cc c++ cpp arm-none-eabi-c++ arm-none-eabi-cpp arm-none-eabi-gcc arm-none-eabi-g++; do ln -s /usr/bin/ccache /opt/ccache/bin/$(basename $prog); done
ENV PATH /opt/ccache/bin:$PATH
@ -44,4 +47,7 @@ RUN setcap 'CAP_NET_RAW+eip CAP_NET_ADMIN+eip' /usr/bin/tcpdump
# Allow non-root to use gdb on processes (will need SYS_PTRACE capability when running the container)
RUN setcap 'CAP_SYS_PTRACE+eip' /usr/bin/gdb
USER ${UID}:${GID}
# Add in Jenkins userID
RUN for i in $(seq 1001 1010); do ( getent passwd ${i} || useradd -ms /bin/bash jenkins${i} -u ${i} -g ${GID} ); done
USER ${UID}:${GID}

View File

@ -8,11 +8,4 @@ RUN DEBIAN_FRONTEND=noninteractive apt update && apt install -y apt-utils \
&& apt install -y ${DEPS_TESTING} \
&& apt clean -y && rm -rf /var/lib/apt/lists/*
ARG JENKINS_UID=1009
ARG JENKINS_GID=1010
RUN groupadd -f -g ${JENKINS_GID} jenkins && ( getent passwd ${JENKINS_UID} || useradd -ms /bin/bash jenkins -u ${JENKINS_UID} -g ${JENKINS_GID} )
# Add github.com as an SSH known host
RUN ssh -o StrictHostKeyChecking=no -T git@github.com; cat ~/.ssh/known_hosts >> /etc/ssh/ssh_known_hosts
USER docker