2
0

Dockerfile 3.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. ARG DOCKER_BASE_IMAGE=ubuntu:22.04
  2. FROM $DOCKER_BASE_IMAGE
  3. USER root
  4. ARG DEPS_WOLFSSL="build-essential autoconf libtool clang clang-tools zlib1g-dev libuv1-dev libpam0g-dev valgrind git linux-headers-generic gcc-multilib g++-multilib libpcap-dev bubblewrap gdb iputils-ping lldb bsdmainutils netcat binutils-arm-linux-gnueabi binutils-aarch64-linux-gnu"
  5. ARG DEPS_LIBOQS="astyle cmake gcc ninja-build libssl-dev python3-pytest python3-pytest-xdist unzip xsltproc doxygen graphviz python3-yaml valgrind git"
  6. ARG DEPS_UDP_PROXY="wget libevent-dev"
  7. ARG DEPS_TESTS="abi-dumper libcurl4-openssl-dev tcpdump"
  8. ARG DEPS_TOOLS="ccache"
  9. RUN DEBIAN_FRONTEND=noninteractive apt update && apt install -y apt-utils \
  10. && apt install -y ${DEPS_WOLFSSL} ${DEPS_LIBOQS} ${DEPS_UDP_PROXY} ${DEPS_TESTS} ${DEPS_TOOLS} \
  11. && apt clean -y && rm -rf /var/lib/apt/lists/*
  12. # Add 'docker' user
  13. ARG USER=docker
  14. ARG UID=1000
  15. ARG GID=1000
  16. RUN groupadd -f -g ${GID} docker && ( getent passwd ${UID} || useradd -ms /bin/bash ${USER} -u ${UID} -g ${GID} )
  17. # Add github.com as an SSH known host
  18. RUN ssh -o StrictHostKeyChecking=no -T git@github.com; cat ~/.ssh/known_hosts >> /etc/ssh/ssh_known_hosts
  19. # install ccache
  20. 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
  21. ENV PATH /opt/ccache/bin:$PATH
  22. # install liboqs
  23. RUN git clone --single-branch https://github.com/open-quantum-safe/liboqs.git && cd liboqs && git checkout db08f12b5a96aa6582a82aac7f65cf8a4d8b231f \
  24. && mkdir build && cd build && cmake -DOQS_DIST_BUILD=ON -DOQS_USE_CPUFEATURE_INSTRUCTIONS=OFF -DOQS_USE_OPENSSL=0 .. && make -j8 all && make install && cd ../.. && rm -rf liboqs
  25. RUN mkdir /opt/sources
  26. # install liblms
  27. RUN cd /opt/sources && git clone --single-branch https://github.com/cisco/hash-sigs.git && cd hash-sigs && git checkout b0631b8891295bf2929e68761205337b7c031726 \
  28. && sed -i 's/USE_OPENSSL 1/USE_OPENSSL 0/g' sha256.h && make -j4 hss_lib_thread.a
  29. # Install pkixssh to /opt/pkixssh for X509 interop testing with wolfSSH
  30. RUN mkdir /var/empty
  31. RUN cd /opt/sources && wget -q -O- https://roumenpetrov.info/secsh/src/pkixssh-14.1.1.tar.gz | tar xzf - && cd pkixssh-14.1.1 && ./configure --prefix=/opt/pkixssh/ --exec-prefix=/opt/pkixssh/ && make install
  32. # Install udp/tcp-proxy
  33. RUN cd /opt/sources && git clone --depth=1 --single-branch --branch=main http://github.com/wolfssl/udp-proxy && cd udp-proxy && make && cp tcp_proxy udp_proxy /bin/.
  34. # Allow non-root to use tcpdump (will need NET_RAW and NET_ADMIN capability when running the container)
  35. RUN setcap 'CAP_NET_RAW+eip CAP_NET_ADMIN+eip' /usr/bin/tcpdump
  36. # Allow non-root to use gdb on processes (will need SYS_PTRACE capability when running the container)
  37. RUN setcap 'CAP_SYS_PTRACE+eip' /usr/bin/gdb
  38. # Add in Jenkins userID
  39. RUN for i in $(seq 1001 1010); do ( getent passwd ${i} || useradd -ms /bin/bash jenkins${i} -u ${i} -g ${GID} ); done
  40. USER ${UID}:${GID}