From 9af26bcec2897a0d443fc7233a106f4766d0e50e Mon Sep 17 00:00:00 2001 From: Yurii Hordynskyi Date: Thu, 28 Nov 2024 17:39:49 +0200 Subject: [PATCH 1/2] Initial version of Debian Bookworm Dockers Signed-off-by: Yurii Hordynskyi --- build.sh | 12 +- dockerfiles/bookworm/Dockerfile | 133 ++++++++++++++++++ dockerfiles/bookworm/Dockerfile.client | 121 ++++++++++++++++ .../bookworm/Dockerfile.saithrift-client | 57 ++++++++ .../bookworm/Dockerfile.saithrift-server | 82 +++++++++++ dockerfiles/bookworm/Dockerfile.server | 120 ++++++++++++++++ dockerfiles/bookworm/pip.conf | 2 + run.sh | 4 +- 8 files changed, 529 insertions(+), 2 deletions(-) create mode 100644 dockerfiles/bookworm/Dockerfile create mode 100644 dockerfiles/bookworm/Dockerfile.client create mode 100644 dockerfiles/bookworm/Dockerfile.saithrift-client create mode 100644 dockerfiles/bookworm/Dockerfile.saithrift-server create mode 100644 dockerfiles/bookworm/Dockerfile.server create mode 100644 dockerfiles/bookworm/pip.conf diff --git a/build.sh b/build.sh index ddfddbf8..6368260c 100755 --- a/build.sh +++ b/build.sh @@ -21,6 +21,8 @@ base_os_map["deb10"]="buster" base_os_map["buster"]="buster" base_os_map["deb11"]="bullseye" base_os_map["bullseye"]="bullseye" +base_os_map["deb12"]="bookworm" +base_os_map["bookworm"]="bookworm" print-help() { @@ -36,7 +38,7 @@ print-help() { echo " Target device with this NPU" echo " -s [redis|thrift]" echo " SAI interface" - echo " -o [buster|bullseye]" + echo " -o [buster|bullseye|bookworm]" echo " Docker image base OS" echo " --nosnappi" echo " Do not include snappi to the final image" @@ -143,6 +145,14 @@ print-build-options() { trap print-build-options EXIT +# Link the pip configuration file to copy to the Docker image +if [ "${BASE_OS}" = "bookworm" ]; then + rm -f pip.conf + if [ -f dockerfiles/${BASE_OS}/pip.conf ]; then + ln -s dockerfiles/${BASE_OS}/pip.conf pip.conf + fi +fi + # Build base Docker image if [ "${IMAGE_TYPE}" = "standalone" ]; then docker build -f dockerfiles/${BASE_OS}/Dockerfile -t sc-base:${BASE_OS} . diff --git a/dockerfiles/bookworm/Dockerfile b/dockerfiles/bookworm/Dockerfile new file mode 100644 index 00000000..c2e80c0f --- /dev/null +++ b/dockerfiles/bookworm/Dockerfile @@ -0,0 +1,133 @@ +FROM debian:bookworm-slim + +## Make apt-get non-interactive +ENV DEBIAN_FRONTEND=noninteractive + +# Copy the pip.conf file +COPY pip.conf /root/.config/pip/pip.conf + +# Install generic packages +RUN apt-get -o Acquire::Check-Valid-Until=false update && apt-get install -y \ + apt-utils \ + vim \ + curl \ + wget \ + iproute2 \ + unzip \ + git \ + procps \ + build-essential \ + graphviz \ + doxygen \ + aspell \ + python3-pip \ + rsyslog \ + supervisor + +# Add support for supervisord to handle startup dependencies +RUN pip3 install supervisord-dependent-startup==1.4.0 + +# Install dependencies +RUN apt-get install -y redis-server libhiredis0.14 python3-redis libc-ares2 + +# Install sonic-swss-common & sonic-sairedis building dependencies +RUN apt-get install -y \ + make libtool m4 autoconf dh-exec debhelper automake cmake pkg-config \ + libhiredis-dev libnl-3-dev libnl-genl-3-dev libnl-route-3-dev swig \ + libgtest-dev libgmock-dev libboost-dev autoconf-archive \ + uuid-dev libboost-serialization-dev nlohmann-json3-dev + +RUN apt-get install -y \ + libnl-3-dev libnl-genl-3-dev libnl-route-3-dev libnl-nf-3-dev libzmq3-dev + +COPY sai.env / + +RUN git clone --recursive https://github.com/sonic-net/sonic-swss-common \ + && cd sonic-swss-common \ + && . /sai.env \ + && git checkout ${SWSS_COMMON_ID} \ + && ./autogen.sh \ + && export DEB_BUILD_PROFILES="nopython2 noyangmod" \ + && export DEB_DH_SHLIBDEPS_ARGS_ALL=--dpkg-shlibdeps-params=--ignore-missing-info \ + && dpkg-buildpackage -us -uc -b --jobs=auto \ + && cd .. \ + && dpkg -i libswsscommon_1.0.0_amd64.deb \ + && dpkg -i libswsscommon-dev_1.0.0_amd64.deb \ + && rm -rf sonic-swss-common \ + && rm -f *swsscommon* + +WORKDIR /sai + +# Install ptf_nn_agent dependencies +RUN apt-get install -y libffi-dev \ + && wget https://github.com/nanomsg/nanomsg/archive/1.0.0.tar.gz \ + && tar xvfz 1.0.0.tar.gz \ + && cd nanomsg-1.0.0 \ + && mkdir -p build \ + && cd build \ + && cmake .. \ + && make install \ + && ldconfig \ + && cd ../.. \ + && rm -rf 1.0.0.tar.gz nanomsg-1.0.0 \ + && pip3 install nnpy + +# Update Redis configuration: +# - Enable keyspace notifications as per sonic-swss-common/README.md +# - Do not daemonize redis-server since supervisord will manage it +# - Do not save Redis DB on disk +RUN sed -ri 's/^# unixsocket/unixsocket/' /etc/redis/redis.conf \ + && sed -ri 's/^unixsocketperm .../unixsocketperm 777/' /etc/redis/redis.conf \ + && sed -ri 's/redis-server.sock/redis.sock/' /etc/redis/redis.conf \ + && sed -ri 's/notify-keyspace-events ""/notify-keyspace-events AKE/' /etc/redis/redis.conf \ + && sed -ri 's/^daemonize yes/daemonize no/' /etc/redis/redis.conf \ + && sed -ri 's/^save/# save/' /etc/redis/redis.conf + +# Disable kernel logging support +RUN sed -ri '/imklog/s/^/#/' /etc/rsyslog.conf + +# Install PTF dependencies +RUN pip3 install scapy dpkt + +# Install ptf_nn_agent and PTF helpers (required by sai_dataplane.py) +COPY ptf/ptf_nn/ptf_nn_agent.py /ptf/ptf_nn/ptf_nn_agent.py +COPY ptf/setup.py /ptf/setup.py +COPY ptf/README.md /ptf/README.md +COPY ptf/src/ptf/*.py /ptf/src/ptf/ +COPY ptf/src/ptf/platforms/*.py /ptf/src/ptf/platforms/ +COPY ptf/requirements.txt /ptf/requirements.txt + +RUN echo "#mock" > /ptf/ptf && pip3 install /ptf + +# Install SAI attributes metadata JSON generator +COPY scripts/gen_attr_list /sai/gen_attr_list + +# Install SAI-C dependencies +RUN pip3 install pytest pytest_dependency pytest-html aenum pdbpp macaddress click==8.0 +RUN apt-get install -y python3-paramiko + +# Fix invoke/loader.py:3: DeprecationWarning caused by load_module() +RUN pip3 install --upgrade invoke>=2.2.0 + +# Deploy SAI Challenger +COPY common /sai-challenger/common +COPY cli /sai-challenger/cli +COPY topologies /sai-challenger/topologies +COPY setup.py /sai-challenger/setup.py +COPY scripts/sai-cli-completion.sh /sai-challenger/scripts/sai-cli-completion.sh +RUN echo ". /sai-challenger/scripts/sai-cli-completion.sh" >> /root/.bashrc + +# Deploy a remote commands listener +COPY scripts/redis-cmd-listener.py /sai-challenger/scripts/redis-cmd-listener.py + +# Install SAI Challenger +RUN pip3 install /sai-challenger/common /sai-challenger + +WORKDIR /sai-challenger/tests + +# Setup supervisord +COPY scripts/veth-create.sh /usr/bin/veth-create.sh +COPY scripts/redis_start.sh /usr/bin/redis_start.sh +COPY configs/supervisord.conf /etc/supervisor/conf.d/supervisord.conf + +CMD ["/usr/bin/supervisord"] diff --git a/dockerfiles/bookworm/Dockerfile.client b/dockerfiles/bookworm/Dockerfile.client new file mode 100644 index 00000000..b043e05e --- /dev/null +++ b/dockerfiles/bookworm/Dockerfile.client @@ -0,0 +1,121 @@ +FROM debian:bookworm-slim + +## Make apt-get non-interactive +ENV DEBIAN_FRONTEND=noninteractive + +# Copy the pip.conf file +COPY pip.conf /root/.config/pip/pip.conf + +# Install generic packages +RUN apt-get -o Acquire::Check-Valid-Until=false update && apt-get install -y \ + apt-utils \ + build-essential \ + python3 \ + python3-pip \ + python3-redis \ + iproute2 \ + rsyslog \ + supervisor \ + cmake \ + graphviz \ + doxygen \ + aspell \ + git \ + wget \ + libffi-dev \ + nlohmann-json3-dev \ + python3-paramiko \ + && rm -rf /var/lib/apt/lists/* + +WORKDIR /sai + +# Install SAI attributes metadata JSON generator +COPY scripts/gen_attr_list /sai/gen_attr_list +COPY sai.env / + +RUN git clone https://github.com/opencomputeproject/SAI.git \ + && cd SAI \ + && . /sai.env \ + && git checkout ${SAI_ID} \ + && cd meta \ + && make saimetadata.h \ + && make saimetadata.c \ + && cd .. \ + && mkdir /usr/include/sai \ + && cp inc/* /usr/include/sai/ \ + && cp experimental/* /usr/include/sai/ \ + && cp meta/sai*.h /usr/include/sai/ \ + && cp meta/saimetadatautils.c /sai/gen_attr_list/ \ + && cp meta/saimetadata.c /sai/gen_attr_list/ \ + && cp meta/saiserialize.c /sai/gen_attr_list/ \ + && cd /sai/gen_attr_list \ + && mkdir build && cd build \ + && cmake .. \ + && make -j$(nproc) \ + && mkdir -p /etc/sai \ + && ./attr_list_generator > /etc/sai/sai.json.tmp \ + && python3 -mjson.tool /etc/sai/sai.json.tmp > /etc/sai/sai.json \ + && rm /etc/sai/sai.json.tmp \ + && rm -rf /sai/SAI + +# Install SAI-C dependencies +RUN pip3 install pytest pytest_dependency pytest-html aenum pdbpp macaddress click==8.0 + +ARG NOSNAPPI +RUN if [ "$NOSNAPPI" != "y" ]; then \ + pip3 install snappi==0.11.14 snappi_ixnetwork==0.9.1 ; \ + fi + +# Fix invoke/loader.py:3: DeprecationWarning caused by load_module() +RUN pip3 install --upgrade invoke>=2.2.0 + +# Install PTF dependencies +RUN pip3 install scapy dpkt + +# Install ptf_nn_agent dependencies +RUN wget https://github.com/nanomsg/nanomsg/archive/1.0.0.tar.gz \ + && tar xvfz 1.0.0.tar.gz \ + && cd nanomsg-1.0.0 \ + && mkdir -p build \ + && cd build \ + && cmake .. \ + && make install \ + && ldconfig \ + && cd ../.. \ + && rm -rf 1.0.0.tar.gz nanomsg-1.0.0 \ + && pip3 install nnpy + +# Install ptf_nn_agent and PTF helpers (required by sai_dataplane.py) +COPY ptf/ptf_nn/ptf_nn_agent.py /ptf/ptf_nn/ptf_nn_agent.py +COPY ptf/setup.py /ptf/setup.py +COPY ptf/README.md /ptf/README.md +COPY ptf/src/ptf/*.py /ptf/src/ptf/ +COPY ptf/src/ptf/platforms/*.py /ptf/src/ptf/platforms/ +COPY ptf/requirements.txt /ptf/requirements.txt +RUN echo "#mock" > /ptf/ptf && pip3 install /ptf + +# Deploy SAI Challenger +COPY common /sai-challenger/common +COPY cli /sai-challenger/cli +COPY topologies /sai-challenger/topologies +COPY setup.py /sai-challenger/setup.py +COPY scripts/sai-cli-completion.sh /sai-challenger/scripts/sai-cli-completion.sh +RUN echo ". /sai-challenger/scripts/sai-cli-completion.sh" >> /root/.bashrc + +# Deploy a remote commands listener (mock for setup.py) +RUN mkdir -p /sai-challenger/scripts \ + && echo "#mock" > /sai-challenger/scripts/redis-cmd-listener.py + +# Install SAI Challenger +RUN pip3 install /sai-challenger/common /sai-challenger + +# Disable kernel logging support +RUN sed -ri '/imklog/s/^/#/' /etc/rsyslog.conf + +WORKDIR /sai-challenger/tests + +# Setup supervisord +COPY configs/client/supervisord.conf /etc/supervisor/conf.d/supervisord.conf + +CMD ["/usr/bin/supervisord"] + diff --git a/dockerfiles/bookworm/Dockerfile.saithrift-client b/dockerfiles/bookworm/Dockerfile.saithrift-client new file mode 100644 index 00000000..073fd725 --- /dev/null +++ b/dockerfiles/bookworm/Dockerfile.saithrift-client @@ -0,0 +1,57 @@ +FROM sc-client:bookworm + +# Copy the pip.conf file +COPY pip.conf /root/.config/pip/pip.conf + +ENV SAIGEN_DEPS libgetopt-long-descriptive-perl libconst-fast-perl \ + libtemplate-perl libnamespace-autoclean-perl \ + libmoose-perl libmoosex-aliases-perl + +WORKDIR /sai + +# Install Thrift code gen +RUN apt-get -o Acquire::Check-Valid-Until=false update \ + && apt install -y libtool pkg-config \ + && wget "http://archive.apache.org/dist/thrift/0.11.0/thrift-0.11.0.tar.gz" \ + && tar -xf thrift-0.11.0.tar.gz \ + && cd thrift-0.11.0 \ + && ./bootstrap.sh \ + && ./configure --prefix=/usr --with-cpp --with-python \ + --with-qt4=no --with-qt5=no --with-csharp=no --with-java=no --with-erlang=no \ + --with-nodejs=no --with-lua=no --with-per=no --with-php=no --with-dart=no \ + --with-ruby=no --with-haskell=no --with-go=no --with-rs=no --with-haxe=no \ + --with-dotnetcore=no --with-d=no \ + && make && make install \ + && pip3 install ctypesgen lib/py \ + && cd /sai \ + && rm -rf thrift-0.11.0 thrift-0.11.0.tar.gz \ + && rm -rf /var/lib/apt/lists/* + +COPY sai.env /sai + +RUN apt-get -o Acquire::Check-Valid-Until=false update \ + && apt install -y ${SAIGEN_DEPS} \ + && git clone https://github.com/opencomputeproject/SAI.git \ + && cd SAI \ + && . /sai/sai.env \ + && git checkout ${SAI_ID} \ + && cp inc/* /usr/include/sai/ \ + && cp experimental/* /usr/include/sai/ \ + && cd test/saithriftv2/ \ + && make meta \ + && make install-pylib \ + && cd dist \ + && tar zxf saithrift-0.9.tar.gz \ + && cd saithrift-0.9 \ + && python3 setup.py install \ + && cd /sai \ + && rm -rf SAI \ + && apt purge -y ${SAIGEN_DEPS} \ + && rm -rf /var/lib/apt/lists/* + +# Install PTF dependencies +RUN pip3 install pysubnettree + +WORKDIR /sai-challenger/tests + +CMD ["/usr/bin/supervisord"] diff --git a/dockerfiles/bookworm/Dockerfile.saithrift-server b/dockerfiles/bookworm/Dockerfile.saithrift-server new file mode 100644 index 00000000..09f30980 --- /dev/null +++ b/dockerfiles/bookworm/Dockerfile.saithrift-server @@ -0,0 +1,82 @@ +FROM debian:bookworm-slim + +## Make apt-get non-interactive +ENV DEBIAN_FRONTEND=noninteractive + +# Copy the pip.conf file +COPY pip.conf /root/.config/pip/pip.conf + +COPY sai.env / + +# Install generic packages +RUN apt-get -o Acquire::Check-Valid-Until=false update && apt-get install -y \ + apt-utils \ + vim \ + curl \ + wget \ + iproute2 \ + unzip \ + git \ + procps \ + build-essential \ + graphviz \ + doxygen \ + aspell \ + python3-pip \ + rsyslog \ + supervisor + +# Add support for supervisord to handle startup dependencies +RUN pip3 install supervisord-dependent-startup==1.4.0 + +# Install generic packages +RUN apt-get install -y \ + libtemplate-perl \ + libconst-fast-perl \ + libmoosex-aliases-perl \ + libnamespace-autoclean-perl \ + libgetopt-long-descriptive-perl \ + aspell-en bison flex g++ \ + libboost-all-dev libevent-dev libssl-dev \ + libpython3-dev libpcap-dev + +WORKDIR /sai + +RUN apt-get install -y pkg-config \ + && wget "http://archive.apache.org/dist/thrift/0.11.0/thrift-0.11.0.tar.gz" \ + && tar -xf thrift-0.11.0.tar.gz \ + && cd thrift-0.11.0 \ + && ./bootstrap.sh \ + && ./configure --prefix=/usr --with-cpp --with-python \ + --with-qt4=no --with-qt5=no --with-csharp=no --with-java=no --with-erlang=no \ + --with-nodejs=no --with-lua=no --with-per=no --with-php=no --with-dart=no \ + --with-ruby=no --with-haskell=no --with-go=no --with-rs=no --with-haxe=no \ + --with-dotnetcore=no --with-d=no \ + && make && make install \ + && pip3 install ctypesgen lib/py \ + && cd /sai \ + && rm -rf thrift-0.11.0 thrift-0.11.0.tar.gz ; + +ENV SAITHRIFTV2=y +ENV GEN_SAIRPC_OPTS="-cve" +ENV SAIRPC_EXTRA_LIBS="-L/usr/local/lib/ -lpthread" + +RUN git clone https://github.com/opencomputeproject/SAI.git \ + && cd SAI && git fetch origin \ + && . /sai.env \ + && git checkout ${SAI_ID} \ + && cd meta \ + && make all libsaimetadata.so libsai.so \ + && cp libsaimetadata.so /usr/lib \ + && cp libsai.so /usr/lib \ + && cd .. \ + && mkdir /usr/include/sai/ \ + && cp ./inc/sai*.h /usr/include/sai/ \ + && cp ./experimental/sai*.h /usr/include/sai/ \ + && make saithrift-install + +WORKDIR /sai-challenger + +COPY configs/server/supervisord.conf.thrift /etc/supervisor/conf.d/supervisord.conf + +CMD ["/usr/bin/supervisord"] diff --git a/dockerfiles/bookworm/Dockerfile.server b/dockerfiles/bookworm/Dockerfile.server new file mode 100644 index 00000000..7730ea4d --- /dev/null +++ b/dockerfiles/bookworm/Dockerfile.server @@ -0,0 +1,120 @@ +FROM debian:bookworm-slim + +## Make apt-get non-interactive +ENV DEBIAN_FRONTEND=noninteractive + +# Copy the pip.conf file +COPY pip.conf /root/.config/pip/pip.conf + +# Install generic packages +RUN apt-get -o Acquire::Check-Valid-Until=false update && apt-get install -y \ + apt-utils \ + vim \ + curl \ + wget \ + iproute2 \ + unzip \ + git \ + procps \ + build-essential \ + graphviz \ + doxygen \ + aspell \ + python3-pip \ + rsyslog \ + supervisor + +# Add support for supervisord to handle startup dependencies +RUN pip3 install supervisord-dependent-startup==1.4.0 + +# Install dependencies +RUN apt-get install -y redis-server libhiredis0.14 python3-redis libc-ares2 + +# Install sonic-swss-common & sonic-sairedis building dependencies +RUN apt-get install -y \ + make libtool m4 autoconf dh-exec debhelper automake cmake pkg-config \ + libhiredis-dev libnl-3-dev libnl-genl-3-dev libnl-route-3-dev swig \ + libgtest-dev libgmock-dev libboost-dev autoconf-archive \ + uuid-dev libboost-serialization-dev nlohmann-json3-dev + +RUN apt-get install -y \ + libnl-3-dev libnl-genl-3-dev libnl-route-3-dev libnl-nf-3-dev libzmq3-dev + +COPY sai.env / +RUN git clone --recursive https://github.com/sonic-net/sonic-swss-common \ + && cd sonic-swss-common \ + && . /sai.env \ + && git checkout ${SWSS_COMMON_ID} \ + && ./autogen.sh \ + && export DEB_BUILD_PROFILES="nopython2 noyangmod" \ + && dpkg-buildpackage -us -uc -b --jobs=auto \ + && cd .. \ + && dpkg -i libswsscommon_1.0.0_amd64.deb \ + && dpkg -i libswsscommon-dev_1.0.0_amd64.deb \ + && rm -rf sonic-swss-common \ + && rm -f *swsscommon* + +WORKDIR /sai + +# Install ptf_nn_agent dependencies +RUN apt-get install -y libffi-dev \ + && wget https://github.com/nanomsg/nanomsg/archive/1.0.0.tar.gz \ + && tar xvfz 1.0.0.tar.gz \ + && cd nanomsg-1.0.0 \ + && mkdir -p build \ + && cd build \ + && cmake .. \ + && make install \ + && ldconfig \ + && cd ../.. \ + && rm -rf 1.0.0.tar.gz nanomsg-1.0.0 \ + && pip3 install nnpy + +# Update Redis configuration: +# - Enable keyspace notifications as per sonic-swss-common/README.md +# - Do not daemonize redis-server since supervisord will manage it +# - Do not save Redis DB on disk +RUN sed -ri 's/^# unixsocket/unixsocket/' /etc/redis/redis.conf \ + && sed -ri 's/^unixsocketperm .../unixsocketperm 777/' /etc/redis/redis.conf \ + && sed -ri 's/redis-server.sock/redis.sock/' /etc/redis/redis.conf \ + && sed -ri 's/notify-keyspace-events ""/notify-keyspace-events AKE/' /etc/redis/redis.conf \ + && sed -ri 's/^daemonize yes/daemonize no/' /etc/redis/redis.conf \ + && sed -ri 's/^save/# save/' /etc/redis/redis.conf + +# Disable kernel logging support +RUN sed -ri '/imklog/s/^/#/' /etc/rsyslog.conf + +# Install ptf_nn_agent and PTF helpers (required by sai_dataplane.py) +COPY ptf/ptf_nn/ptf_nn_agent.py /ptf/ptf_nn/ptf_nn_agent.py +COPY ptf/setup.py /ptf/setup.py +COPY ptf/README.md /ptf/README.md +COPY ptf/src/ptf/*.py /ptf/src/ptf/ +COPY ptf/src/ptf/platforms/*.py /ptf/src/ptf/platforms/ +COPY ptf/requirements.txt /ptf/requirements.txt + +RUN echo "#mock" > /ptf/ptf && pip3 install /ptf + +# Install SAI Challenger CLI dependencies +RUN pip3 install click==8.0 pytest + +# Deploy SAI Challenger CLI +COPY setup.py /sai-challenger/setup.py +COPY cli/__init__.py /sai-challenger/cli/__init__.py +COPY common /sai-challenger/common +COPY topologies /sai-challenger/topologies +COPY .build/* /sai-challenger/ + +# Deploy a remote commands listener +COPY scripts/redis-cmd-listener.py /sai-challenger/scripts/redis-cmd-listener.py + +# Install SAI Challenger +RUN pip3 install /sai-challenger/common /sai-challenger + +WORKDIR /sai-challenger + +# Setup supervisord +COPY scripts/wait-interfaces.sh /usr/bin/wait-interfaces.sh +COPY scripts/redis_start.sh /usr/bin/redis_start.sh +COPY configs/server/supervisord.conf /etc/supervisor/conf.d/supervisord.conf + +CMD ["/usr/bin/supervisord"] diff --git a/dockerfiles/bookworm/pip.conf b/dockerfiles/bookworm/pip.conf new file mode 100644 index 00000000..9d54ef90 --- /dev/null +++ b/dockerfiles/bookworm/pip.conf @@ -0,0 +1,2 @@ +[global] +break-system-packages = true diff --git a/run.sh b/run.sh index 64bb7101..f07439d1 100755 --- a/run.sh +++ b/run.sh @@ -22,6 +22,8 @@ base_os_map["deb10"]="buster" base_os_map["buster"]="buster" base_os_map["deb11"]="bullseye" base_os_map["bullseye"]="bullseye" +base_os_map["deb12"]="bookworm" +base_os_map["bookworm"]="bookworm" print-help() { @@ -42,7 +44,7 @@ print-help() { echo " -r Remove Docker after run" echo " -s [redis|thrift]" echo " SAI interface" - echo " -o [buster|bullseye]" + echo " -o [buster|bullseye|bookworm]" echo " Docker image base OS" echo exit 0 From 7c821dd7bfbee0e8ec2d97a971af20f66ff7d291 Mon Sep 17 00:00:00 2001 From: Yurii Hordynskyi Date: Thu, 28 Nov 2024 18:34:49 +0200 Subject: [PATCH 2/2] Addressed review comments. Signed-off-by: Yurii Hordynskyi --- build.sh | 8 -------- dockerfiles/bookworm/Dockerfile | 6 ++++-- dockerfiles/bookworm/Dockerfile.client | 6 ++++-- dockerfiles/bookworm/Dockerfile.saithrift-client | 6 ++++-- dockerfiles/bookworm/Dockerfile.saithrift-server | 6 ++++-- dockerfiles/bookworm/Dockerfile.server | 6 ++++-- dockerfiles/bookworm/pip.conf | 2 -- 7 files changed, 20 insertions(+), 20 deletions(-) delete mode 100644 dockerfiles/bookworm/pip.conf diff --git a/build.sh b/build.sh index 6368260c..26683be4 100755 --- a/build.sh +++ b/build.sh @@ -145,14 +145,6 @@ print-build-options() { trap print-build-options EXIT -# Link the pip configuration file to copy to the Docker image -if [ "${BASE_OS}" = "bookworm" ]; then - rm -f pip.conf - if [ -f dockerfiles/${BASE_OS}/pip.conf ]; then - ln -s dockerfiles/${BASE_OS}/pip.conf pip.conf - fi -fi - # Build base Docker image if [ "${IMAGE_TYPE}" = "standalone" ]; then docker build -f dockerfiles/${BASE_OS}/Dockerfile -t sc-base:${BASE_OS} . diff --git a/dockerfiles/bookworm/Dockerfile b/dockerfiles/bookworm/Dockerfile index c2e80c0f..97eb1210 100644 --- a/dockerfiles/bookworm/Dockerfile +++ b/dockerfiles/bookworm/Dockerfile @@ -3,8 +3,10 @@ FROM debian:bookworm-slim ## Make apt-get non-interactive ENV DEBIAN_FRONTEND=noninteractive -# Copy the pip.conf file -COPY pip.conf /root/.config/pip/pip.conf +# Generate the pip configuration file +RUN mkdir -p /root/.config/pip \ + && echo "[global]" > /root/.config/pip/pip.conf \ + && echo "break-system-packages = true" >> /root/.config/pip/pip.conf # Install generic packages RUN apt-get -o Acquire::Check-Valid-Until=false update && apt-get install -y \ diff --git a/dockerfiles/bookworm/Dockerfile.client b/dockerfiles/bookworm/Dockerfile.client index b043e05e..802f90b7 100644 --- a/dockerfiles/bookworm/Dockerfile.client +++ b/dockerfiles/bookworm/Dockerfile.client @@ -3,8 +3,10 @@ FROM debian:bookworm-slim ## Make apt-get non-interactive ENV DEBIAN_FRONTEND=noninteractive -# Copy the pip.conf file -COPY pip.conf /root/.config/pip/pip.conf +# Generate the pip configuration file +RUN mkdir -p /root/.config/pip \ + && echo "[global]" > /root/.config/pip/pip.conf \ + && echo "break-system-packages = true" >> /root/.config/pip/pip.conf # Install generic packages RUN apt-get -o Acquire::Check-Valid-Until=false update && apt-get install -y \ diff --git a/dockerfiles/bookworm/Dockerfile.saithrift-client b/dockerfiles/bookworm/Dockerfile.saithrift-client index 073fd725..630545e2 100644 --- a/dockerfiles/bookworm/Dockerfile.saithrift-client +++ b/dockerfiles/bookworm/Dockerfile.saithrift-client @@ -1,7 +1,9 @@ FROM sc-client:bookworm -# Copy the pip.conf file -COPY pip.conf /root/.config/pip/pip.conf +# Generate the pip configuration file +RUN mkdir -p /root/.config/pip \ + && echo "[global]" > /root/.config/pip/pip.conf \ + && echo "break-system-packages = true" >> /root/.config/pip/pip.conf ENV SAIGEN_DEPS libgetopt-long-descriptive-perl libconst-fast-perl \ libtemplate-perl libnamespace-autoclean-perl \ diff --git a/dockerfiles/bookworm/Dockerfile.saithrift-server b/dockerfiles/bookworm/Dockerfile.saithrift-server index 09f30980..9f68285d 100644 --- a/dockerfiles/bookworm/Dockerfile.saithrift-server +++ b/dockerfiles/bookworm/Dockerfile.saithrift-server @@ -3,8 +3,10 @@ FROM debian:bookworm-slim ## Make apt-get non-interactive ENV DEBIAN_FRONTEND=noninteractive -# Copy the pip.conf file -COPY pip.conf /root/.config/pip/pip.conf +# Generate the pip configuration file +RUN mkdir -p /root/.config/pip \ + && echo "[global]" > /root/.config/pip/pip.conf \ + && echo "break-system-packages = true" >> /root/.config/pip/pip.conf COPY sai.env / diff --git a/dockerfiles/bookworm/Dockerfile.server b/dockerfiles/bookworm/Dockerfile.server index 7730ea4d..9621df4a 100644 --- a/dockerfiles/bookworm/Dockerfile.server +++ b/dockerfiles/bookworm/Dockerfile.server @@ -3,8 +3,10 @@ FROM debian:bookworm-slim ## Make apt-get non-interactive ENV DEBIAN_FRONTEND=noninteractive -# Copy the pip.conf file -COPY pip.conf /root/.config/pip/pip.conf +# Generate the pip configuration file +RUN mkdir -p /root/.config/pip \ + && echo "[global]" > /root/.config/pip/pip.conf \ + && echo "break-system-packages = true" >> /root/.config/pip/pip.conf # Install generic packages RUN apt-get -o Acquire::Check-Valid-Until=false update && apt-get install -y \ diff --git a/dockerfiles/bookworm/pip.conf b/dockerfiles/bookworm/pip.conf deleted file mode 100644 index 9d54ef90..00000000 --- a/dockerfiles/bookworm/pip.conf +++ /dev/null @@ -1,2 +0,0 @@ -[global] -break-system-packages = true