Skip to content
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
9 changes: 9 additions & 0 deletions docker-sonic-alpinevs.dep
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#DPKG FRK
DPATH := $($(DOCKER_SONIC_ALPINEVS)_PATH)
DEP_FILES := $(SONIC_COMMON_FILES_LIST) platform/alpinevs/docker-sonic-alpinevs.mk platform/alpinevs/docker-sonic-alpinevs.dep
DEP_FILES += $(SONIC_COMMON_BASE_FILES_LIST)
DEP_FILES += $(shell git ls-files $(DPATH))

$(DOCKER_SONIC_ALPINEVS)_CACHE_MODE := GIT_CONTENT_SHA
$(DOCKER_SONIC_ALPINEVS)_DEP_FLAGS := $(SONIC_COMMON_FLAGS_LIST)
$(DOCKER_SONIC_ALPINEVS)_DEP_FILES := $(DEP_FILES)
68 changes: 68 additions & 0 deletions docker-sonic-alpinevs.mk
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
# docker image for alpine virtual switch based sonic docker image

DOCKER_SONIC_ALPINEVS = docker-sonic-alpinevs.gz
$(DOCKER_SONIC_ALPINEVS)_PATH = $(PLATFORM_PATH)/docker-sonic-alpinevs
$(DOCKER_SONIC_ALPINEVS)_DEPENDS += $(SYNCD_VS) \
$(LEMMINGSAI) \
$(PKT_HANDLER) \
$(PYTHON3_SWSSCOMMON) \
$(SONIC_DEVICE_DATA) \
$(LIBYANG) \
$(LIBYANG3) \
$(LIBYANG_CPP) \
$(LIBYANG_PY3) \
$(SONIC_UTILITIES_DATA) \
$(SONIC_HOST_SERVICES_DATA) \
$(SYSMGR) \
$(SONIC_P4RT) \
$(SONIC_TELEMETRY) \
$(SONIC_MGMT_FRAMEWORK) \
$(SONIC_MGMT_COMMON)

$(DOCKER_SONIC_ALPINEVS)_PYTHON_WHEELS += $(SONIC_PY_COMMON_PY3) \
$(SONIC_PLATFORM_COMMON_PY3) \
$(SONIC_YANG_MODELS_PY3) \
$(SONIC_YANG_MGMT_PY3) \
$(SONIC_UTILITIES_PY3) \
$(SONIC_HOST_SERVICES_PY3)

ifeq ($(INSTALL_DEBUG_TOOLS), y)
$(DOCKER_SONIC_ALPINEVS)_DEPENDS += $(LIBSWSSCOMMON_DBG) \
$(LIBSAIREDIS_DBG) \
$(SYNCD_VS_DBG)
endif

$(DOCKER_SONIC_ALPINEVS)_FILES += $(CONFIGDB_LOAD_SCRIPT) \
$(ARP_UPDATE_SCRIPT) \
$(ARP_UPDATE_VARS_TEMPLATE) \
$(BUFFERS_CONFIG_TEMPLATE) \
$(QOS_CONFIG_TEMPLATE) \
$(SONIC_VERSION) \
$(UPDATE_CHASSISDB_CONFIG_SCRIPT) \
$(COPP_CONFIG_TEMPLATE)

$(DOCKER_SONIC_ALPINEVS)_LOAD_DOCKERS += $(DOCKER_SWSS_LAYER_TRIXIE)
SONIC_DOCKER_IMAGES += $(DOCKER_SONIC_ALPINEVS)
SONIC_TRIXIE_DOCKERS += $(DOCKER_SONIC_ALPINEVS)

ALPINEVS_DOCKER_STAGING_DIR := $(PLATFORM_PATH)/docker-sonic-alpinevs/bin
ALPINEVS_DOCKER_STAGE_FILES := \
$(ALPINEVS_DOCKER_STAGING_DIR)/pkt-handler \
$(ALPINEVS_DOCKER_STAGING_DIR)/alpinevs-config.sh \
$(ALPINEVS_DOCKER_STAGING_DIR)/alpinevs-init.sh

$(ALPINEVS_DOCKER_STAGING_DIR):
mkdir -p $@

$(ALPINEVS_DOCKER_STAGING_DIR)/pkt-handler: | $(ALPINEVS_DOCKER_STAGING_DIR)
$(MAKE) -C $(PLATFORM_PATH)/src/services/pkt-handler all
cp $(PLATFORM_PATH)/src/services/pkt-handler/pkt-handler $@

$(ALPINEVS_DOCKER_STAGING_DIR)/alpinevs-config.sh: | $(ALPINEVS_DOCKER_STAGING_DIR)
cp -L $(PLATFORM_PATH)/src/services/config/alpinevs-config.sh $@

$(ALPINEVS_DOCKER_STAGING_DIR)/alpinevs-init.sh: | $(ALPINEVS_DOCKER_STAGING_DIR)
cp -L $(PLATFORM_PATH)/src/services/init/alpinevs-init.sh $@

$(addprefix $(TARGET_PATH)/,$(DOCKER_SONIC_ALPINEVS)): $(ALPINEVS_DOCKER_STAGE_FILES)

68 changes: 68 additions & 0 deletions docker-sonic-alpinevs/50-default.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
# Default rules for rsyslog.
#
# For more information see rsyslog.conf(5) and /etc/rsyslog.conf

#
# First some standard log files. Log by facility.
#
auth,authpriv.* /var/log/auth.log
*.*;auth,authpriv.none -/var/log/syslog
#cron.* /var/log/cron.log
#daemon.* -/var/log/daemon.log
kern.* -/var/log/kern.log
#lpr.* -/var/log/lpr.log
mail.* -/var/log/mail.log
#user.* -/var/log/user.log

#
# Logging for the mail system. Split it up so that
# it is easy to write scripts to parse these files.
#
#mail.info -/var/log/mail.info
#mail.warn -/var/log/mail.warn
mail.err /var/log/mail.err

#
# Logging for INN news system.
#
news.crit /var/log/news/news.crit
news.err /var/log/news/news.err
news.notice -/var/log/news/news.notice

#
# Some "catch-all" log files.
#
#*.=debug;\
# auth,authpriv.none;\
# news.none;mail.none -/var/log/debug
#*.=info;*.=notice;*.=warn;\
# auth,authpriv.none;\
# cron,daemon.none;\
# mail,news.none -/var/log/messages

#
# Emergencies are sent to everybody logged in.
#
*.emerg :omusrmsg:*

#
# I like to have messages displayed on the console, but only on a virtual
# console I usually leave idle.
#
#daemon,mail.*;\
# news.=crit;news.=err;news.=notice;\
# *.=debug;*.=info;\
# *.=notice;*.=warn /dev/tty8

# The named pipe /dev/xconsole is for the `xconsole' utility. To use it,
# you must invoke `xconsole' with the `-file' option:
#
# $ xconsole -file /dev/xconsole [...]
#
# NOTE: adjust the list below, or you'll go crazy if you have a reasonably
# busy site..
#
daemon.*;mail.*;\
news.err;\
*.=debug;*.=info;\
*.=notice;*.=warn |/dev/xconsole
172 changes: 172 additions & 0 deletions docker-sonic-alpinevs/Dockerfile.j2
Original file line number Diff line number Diff line change
@@ -0,0 +1,172 @@
{% from "dockers/dockerfile-macros.j2" import install_debian_packages, install_python_wheels, copy_files, rsync_from_builder_stage %}
ARG BASE=docker-swss-layer-trixie-{{DOCKER_USERNAME}}:{{DOCKER_USERTAG}}

FROM $BASE AS base

ARG docker_container_name

COPY ["etc/rsyslog.conf", "/etc/rsyslog.conf"]
RUN [ -f /etc/rsyslog.conf ] && sed -ri "s/%syslogtag%/$docker_container_name#%syslogtag%/;" /etc/rsyslog.conf

ENV DEBIAN_FRONTEND=noninteractive

RUN apt-get update && apt-get install -y \
gnupg \
net-tools \
iproute2 \
arping \
ndisc6 \
ethtool \
tcpdump \
ifupdown \
bridge-utils \
libjudydebian1 \
openssh-client \
openssh-server \
sudo \
libc-ares2 \
bash-completion \
logrotate \
apt-utils \
psmisc \
python3-scapy \
conntrack \
iptables \
jq \
uuid-dev \
build-essential \
python3-dev \
python3-gi \
libssl-dev \
swig \
openssl \
libcairo2-dev \
libdbus-1-dev \
libgirepository1.0-dev \
libsystemd-dev \
pkg-config \
gir1.2-glib-2.0 \
libdbus-1-3 \
libgirepository-1.0-1 \
{%- if ENABLE_ASAN == "y" %}
libasan6 \
{%- endif %}
dbus \
redis-server \
libprotobuf-c-dev \
protobuf-c-compiler \
libgoogle-glog-dev \
libgrpc++1.51t64 \
libgrpc29t64 \
libprotobuf32t64 \
libgrpc++-dev \
libgrpc-dev \
libzmq5 \
protobuf-compiler \
protobuf-compiler-grpc \
python3-protobuf \
python3-grpcio

RUN pip3 uninstall -y enum34
RUN pip3 install \
pyangbind==0.8.1 \
pyroute2==0.7.2 \
netifaces==0.11.0

RUN pip3 install meson-python meson ninja patchelf

{% if docker_sonic_alpinevs_debs.strip() -%}
{{ copy_files("debs/", docker_sonic_alpinevs_debs.split(' '), "/debs/") }}
{{ install_debian_packages(docker_sonic_alpinevs_debs.split(' ')) }}
{%- endif %}

{% if docker_sonic_alpinevs_pydebs.strip() -%}
{{ copy_files("python-debs/", docker_sonic_alpinevs_pydebs.split(' '), "/debs/") }}
{{ install_debian_packages(docker_sonic_alpinevs_pydebs.split(' ')) }}
{%- endif %}

# Gracefully remove the Debian-managed cffi package if it exists, otherwise continue
RUN apt-get purge -y python3-cffi python3-cffi-backend || true

{% if docker_sonic_alpinevs_whls.strip() %}
{{ copy_files("python-wheels/", docker_sonic_alpinevs_whls.split(' '), "/python-wheels/") }}
{{ install_python_wheels(docker_sonic_alpinevs_whls.split(' ')) }}
{% endif %}

RUN apt-get purge -y build-essential libssl-dev swig python3-dev
RUN apt-get purge -y libcairo2-dev libdbus-1-dev libgirepository1.0-dev libsystemd-dev pkg-config
RUN apt-get clean -y; apt-get autoclean -y; apt-get autoremove -y
RUN pip3 uninstall -y meson-python meson ninja patchelf
RUN rm -rf /debs ~/.cache

RUN sed -ri 's/^# save ""$/save ""/g; \
s/^daemonize yes$/daemonize no/; \
s/^logfile .*$/logfile ""/; \
s/^# syslog-enabled no$/syslog-enabled no/; \
s/^# unixsocket/unixsocket/; \
s/redis-server.sock/redis.sock/g; \
s/^client-output-buffer-limit pubsub [0-9]+mb [0-9]+mb [0-9]+/client-output-buffer-limit pubsub 0 0 0/; \
s/^notify-keyspace-events ""$/notify-keyspace-events AKE/; \
s/^databases [0-9]+$/databases 100/ \
' /etc/redis/redis.conf

COPY ["50-default.conf", "/etc/rsyslog.d/"]
COPY ["start.sh", "orchagent.sh", "telemetry.sh", "files/update_chassisdb_config", "/usr/bin/"]
COPY ["alpinevs-script.sh", "alpinevs-healthcheck.sh", "p4rt.sh", "bin/alpinevs-init.sh","bin/alpinevs-config.sh","bin/pkt-handler", "/usr/bin/"]
COPY ["uptime", "/usr/local/bin/uptime"]
COPY ["docker", "/usr/local/bin/docker"]
COPY ["supervisord.conf.j2", "/usr/share/sonic/templates/"]
COPY ["p4rt_vars.j2", "telemetry_vars.j2", "swss_vars.j2", "/usr/share/sonic/templates/"]
COPY ["files/configdb-load.sh", "/usr/bin/"]
COPY ["files/arp_update", "/usr/bin/"]
COPY ["files/buffers_config.j2", "files/qos_config.j2", "files/arp_update_vars.j2", "/usr/share/sonic/templates/"]
COPY ["copp_cfg_alpinevs.j2", "/usr/share/sonic/templates/"]
COPY ["files/sonic_version.yml", "/etc/sonic/"]
COPY ["port_breakout_config_db.json", "/etc/sonic/"]
COPY ["database_config.json", "/etc/default/sonic-db/"]
COPY ["hostname.j2", "/usr/share/sonic/templates/"]
COPY ["init_cfg.json.j2", "/usr/share/sonic/templates/"]
COPY ["config_db.json", "/etc/sonic/"]
COPY ["default_chassis_cfg.json", "/etc/default/sonic-db/"]
COPY ["asic_table.json", "/etc/sonic/"]
COPY ["zero_profiles.json", "/etc/sonic"]
COPY ["buffermgrd.sh", "/usr/bin/"]

# Copy the entire device hardware profile directory structure
COPY ["device/", "/usr/share/sonic/device/"]

RUN mkdir -p /etc/supervisor/conf.d/
RUN sonic-cfggen -a "{\"ENABLE_ASAN\":\"{{ENABLE_ASAN}}\"}" -t /usr/share/sonic/templates/supervisord.conf.j2 > /etc/supervisor/conf.d/supervisord.conf
RUN rm -f /usr/share/sonic/templates/supervisord.conf.j2

{%- if ENABLE_ASAN == "y" %}
RUN mkdir -p /var/log/asan
{%- endif %}

RUN echo "docker-sonic-alpinevs" > /etc/hostname

FROM $BASE

{{ rsync_from_builder_stage() }}

# Create /zmq_swss directory for ZMQ IPC sockets
RUN mkdir -p /zmq_swss

# Create the sock directory for p4rt's use
RUN mkdir -p /sock

RUN mkdir -p /var/run/sshd

RUN useradd -m -s /bin/bash admin && \
echo "admin:google" | chpasswd && \
echo "admin ALL=(ALL) NOPASSWD:ALL" >> /etc/sudoers && \
chown -R admin:admin /home/admin && \
sed -i 's/^#PermitRootLogin.*/PermitRootLogin no/' /etc/ssh/sshd_config

COPY sshd.conf /etc/supervisor/conf.d/sshd.conf

ENV PLATFORM=x86_64-kvm_x86_64-r0
ENV HWSKU=alpinevs
ENV SOC_TARGET_SERVER=127.0.0.1:50000
Comment thread
sonikajindal marked this conversation as resolved.

ENTRYPOINT ["/usr/local/bin/supervisord"]
Loading
Loading