Skip to content

Commit

Permalink
Generic docker image
Browse files Browse the repository at this point in the history
Signed-off-by: Yurii Lisovskyi <[email protected]>
  • Loading branch information
yuriilisovskyi committed Sep 29, 2023
1 parent 9ca0a0c commit 1ecb98b
Show file tree
Hide file tree
Showing 3 changed files with 101 additions and 3 deletions.
3 changes: 2 additions & 1 deletion build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -155,9 +155,10 @@ if [ "${IMAGE_TYPE}" = "standalone" ]; then
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/${BASE_OS}/Dockerfile.server -t sc-server-base:${BASE_OS} ${CACHE} .
if [ "${SAI_INTERFACE}" = "thrift" ]; then
docker build -f dockerfiles/${BASE_OS}/Dockerfile.saithrift-server -t sc-thrift-server-base:${BASE_OS} ${CACHE} .
else
docker build -f dockerfiles/${BASE_OS}/Dockerfile.server -t sc-server-base:${BASE_OS} ${CACHE} .
fi
rm -rf .build/
else
Expand Down
41 changes: 41 additions & 0 deletions configs/server/supervisord.conf.thrift
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
[supervisord]
logfile_maxbytes=1MB
logfile_backups=2
nodaemon=true

[eventlistener:dependent-startup]
command=python3 -m supervisord_dependent_startup
autostart=true
autorestart=unexpected
startretries=0
exitcodes=0,3
events=PROCESS_STATE
buffer_size=1024

[program:rsyslogd]
command=/usr/sbin/rsyslogd -n -iNONE
priority=1
autostart=false
autorestart=false
stdout_logfile=syslog
stderr_logfile=syslog
dependent_startup=true

[program:wait-interfaces]
command=/usr/bin/wait-interfaces.sh
priority=2
startsecs=0
autostart=false
autorestart=false
dependent_startup=true

[program:syncd]
command=/usr/bin/syncd -s -p /etc/sai.d/sai.profile
priority=5
autostart=false
autorestart=true
stdout_logfile=syslog
stderr_logfile=syslog
dependent_startup=true
dependent_startup_wait_for=rsyslogd:running wait-interfaces:exited

60 changes: 58 additions & 2 deletions dockerfiles/buster/Dockerfile.saithrift-server
Original file line number Diff line number Diff line change
@@ -1,4 +1,58 @@
FROM sc-server-base:buster
FROM debian:buster-slim

RUN echo "deb [arch=amd64] http://debian-archive.trafficmanager.net/debian/ buster main contrib non-free" >> /etc/apt/sources.list && \
echo "deb-src [arch=amd64] http://debian-archive.trafficmanager.net/debian/ buster main contrib non-free" >> /etc/apt/sources.list && \
echo "deb [arch=amd64] http://debian-archive.trafficmanager.net/debian-security/ buster/updates main contrib non-free" >> /etc/apt/sources.list && \
echo "deb-src [arch=amd64] http://debian-archive.trafficmanager.net/debian-security/ buster/updates main contrib non-free" >> /etc/apt/sources.list && \
echo "deb [arch=amd64] http://debian-archive.trafficmanager.net/debian buster-backports main" >> /etc/apt/sources.list

## 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 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 swig3.0 \
libgtest-dev libgmock-dev libboost-dev autoconf-archive \
uuid-dev libboost-serialization-dev libyang-dev libyang0.16

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*

# Install generic packages
RUN apt-get install -y \
Expand All @@ -18,4 +72,6 @@ RUN apt-get install -y thrift-compiler libthrift-dev libthrift-0.11.0 \

WORKDIR /sai-challenger

CMD ["/usr/bin/supervisord"]
COPY configs/server/supervisord.conf.thrift /etc/supervisor/conf.d/supervisord.conf

CMD ["/usr/bin/supervisord"]

0 comments on commit 1ecb98b

Please sign in to comment.