Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Docker bullseye #160

Merged
merged 3 commits into from
Jun 27, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 12 additions & 4 deletions build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ ASIC_TYPE=""
ASIC_PATH=""
TARGET=""
SAI_INTERFACE="redis"
BASE_OS="buster"

print-help() {
echo
Expand All @@ -27,6 +28,8 @@ print-help() {
echo " Target device with this NPU"
echo " -s [redis|thrift]"
echo " SAI interface"
echo " -o [buster|bullseye]"
echo " Docker image base OS"
echo
exit 0
}
Expand Down Expand Up @@ -54,6 +57,10 @@ while [[ $# -gt 0 ]]; do
SAI_INTERFACE="$2"
shift
;;
"-o"|"--base_os")
BASE_OS="$2"
shift
;;
esac
shift
done
Expand Down Expand Up @@ -104,6 +111,7 @@ print-build-options() {
echo "==========================================="
echo
echo " Docker image type : ${IMAGE_TYPE}"
echo " Base OS : ${BASE_OS}"
echo " ASIC name : ${ASIC_TYPE}"
echo " ASIC target : ${TARGET}"
echo " Platform path : ${ASIC_PATH}"
Expand All @@ -117,16 +125,16 @@ trap print-build-options EXIT

# Build base Docker image
if [ "${IMAGE_TYPE}" = "standalone" ]; then
docker build -f dockerfiles/Dockerfile -t sc-base .
docker build -f dockerfiles/${BASE_OS}/Dockerfile -t sc-base .
elif [ "${IMAGE_TYPE}" = "server" ]; then
find ${ASIC_PATH}/../ -type f -name \*.py -exec install -D {} .build/{} \;
find ${ASIC_PATH}/../ -type f -name \*.json -exec install -D {} .build/{} \;
docker build -f dockerfiles/Dockerfile.server -t sc-server-base .
docker build -f dockerfiles/${BASE_OS}/Dockerfile.server -t sc-server-base .
rm -rf .build/
else
docker build -f dockerfiles/Dockerfile.client -t sc-client .
docker build -f dockerfiles/${BASE_OS}/Dockerfile.client -t sc-client .
if [ "${SAI_INTERFACE}" = "thrift" ]; then
docker build -f dockerfiles/Dockerfile.saithrift-client -t sc-thrift-client .
docker build -f dockerfiles/${BASE_OS}/Dockerfile.saithrift-client -t sc-thrift-client .
fi
fi

Expand Down
128 changes: 128 additions & 0 deletions dockerfiles/bullseye/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,128 @@
FROM debian:bullseye-slim

MAINTAINER [email protected]

## Make apt-get non-interactive
ENV DEBIAN_FRONTEND=noninteractive

# 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 libyang-dev libyang1

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 \
&& 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
RUN apt-get install -y nlohmann-json3-dev

# 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

# 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"]
113 changes: 113 additions & 0 deletions dockerfiles/bullseye/Dockerfile.client
Original file line number Diff line number Diff line change
@@ -0,0 +1,113 @@
FROM debian:bullseye-slim

MAINTAINER [email protected]

## Make apt-get non-interactive
ENV DEBIAN_FRONTEND=noninteractive

# 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 \
nlohmann-json3-dev \
python3-paramiko

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

# Install snappi
RUN pip3 install snappi==0.11.14 snappi_ixnetwork==0.9.1

# Install PTF dependencies
RUN pip3 install scapy dpkt

# Install ptf_nn_agent dependencies
RUN apt-get install -y libffi-dev cmake wget \
&& 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"]

53 changes: 53 additions & 0 deletions dockerfiles/bullseye/Dockerfile.saithrift-client
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
FROM sc-client

MAINTAINER [email protected]

ENV SAIGEN_DEPS libgetopt-long-descriptive-perl libconst-fast-perl \
libtemplate-perl libnamespace-autoclean-perl \
libmoose-perl libmoosex-aliases-perl thrift-compiler

RUN apt install -y libthrift-dev

RUN pip3 install ctypesgen

RUN apt install -y libtool

# Install Thrift code gen
RUN 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 lib/py \
&& cd /sai \
&& rm -rf thrift-0.11.0 thrift-0.11.0.tar.gz

COPY sai.env /sai

WORKDIR /sai
RUN 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}

WORKDIR /sai-challenger/tests

CMD ["/usr/bin/supervisord"]
Loading