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

[dockers]: Add SONiC SDK Docker #3968

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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
87 changes: 87 additions & 0 deletions dockers/docker-sonic-sdk/Dockerfile.j2
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
{% from "dockers/dockerfile-macros.j2" import install_debian_packages, install_python_wheels, copy_files %}
FROM docker-config-engine-stretch

COPY ["etc/rsyslog.conf", "/etc/rsyslog.conf"]
COPY ["etc/rsyslog.d/*", "/etc/rsyslog.d/"]

COPY ["etc/supervisor/supervisord.conf", "/etc/supervisor/"]

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

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

RUN apt-get update && \
apt-get install -f -y \
ifupdown \
arping \
libdbus-1-3 \
libdaemon0 \
libjansson4 \
libpython2.7 \
iproute2 \
ndisc6 \
tcpdump \
libatomic1 \
libjemalloc1 \
liblua5.1-0 \
lua-bitop \
lua-cjson \
libelf1 \
libmnl0 \
bridge-utils


## Build tools
RUN apt-get update && \
apt-get install -f -y \
autoconf \
automake \
libtool \
curl \
make \
g++ \
gcc \
vim \
git \
unzip

{% if ( CONFIGURED_ARCH == "armhf" or CONFIGURED_ARCH == "arm64" ) %}
## Fix for gcc/python not found in arm docker
RUN apt-get install -f -y python2.7 python2.7-dev
RUN apt-get install -y gcc-6
{% endif %}
{% if CONFIGURED_ARCH == "armhf" %}
RUN ln -s -f /usr/bin/gcc-6 /usr/bin/arm-linux-gnueabihf-gcc
{% endif %}
{% if CONFIGURED_ARCH == "arm64" %}
RUN ln -s -f /usr/bin/gcc-6 /usr/bin/aarch64-linux-gnu-gcc
{% endif %}

#RUN pip install \
# scapy==2.4.2 \
# setuptools \
# pyroute2==0.5.3
#RUN pip install \
# netifaces==0.10.7 \
# monotonic==1.5

{% if ( CONFIGURED_ARCH == "armhf" or CONFIGURED_ARCH == "arm64" ) %}
# Remove installed gcc
RUN apt-get remove -y gcc-6
{% endif %}

{% if docker_sonic_sdk_debs.strip() -%}
# Copy locally-built Debian package dependencies
{{ copy_files("debs/", docker_sonic_sdk_debs.split(' '), "/debs/") }}

# Install locally-built Debian packages and implicitly install their dependencies
{{ install_debian_packages(docker_sonic_sdk_debs.split(' ')) }}
{%- endif %}

## Clean up
RUN apt-get clean -y && \
apt-get autoclean -y && \
apt-get autoremove -y && \
rm -rf /debs
76 changes: 76 additions & 0 deletions dockers/docker-sonic-sdk/etc/rsyslog.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
#
# /etc/rsyslog.conf Configuration file for rsyslog.
#
# For more information see
# /usr/share/doc/rsyslog-doc/html/rsyslog_conf.html


#################
#### MODULES ####
#################

$ModLoad imuxsock # provides support for local system logging

#
# Set a rate limit on messages from the container
#
$SystemLogRateLimitInterval 300
$SystemLogRateLimitBurst 20000

#$ModLoad imklog # provides kernel logging support
#$ModLoad immark # provides --MARK-- message capability

# provides UDP syslog reception
#$ModLoad imudp
#$UDPServerRun 514

# provides TCP syslog reception
#$ModLoad imtcp
#$InputTCPServerRun 514


###########################
#### GLOBAL DIRECTIVES ####
###########################

# Set remote syslog server
template (name="ForwardFormatInContainer" type="string" string="<%PRI%>%TIMESTAMP:::date-rfc3339% %HOSTNAME% %syslogtag%%msg:::sp-if-no-1st-sp%%msg%")
*.* action(type="omfwd" target="127.0.0.1" port="514" protocol="udp" Template="ForwardFormatInContainer")

#
# Use traditional timestamp format.
# To enable high precision timestamps, comment out the following line.
#
#$ActionFileDefaultTemplate RSYSLOG_TraditionalFileFormat

# Define a custom template
$template SONiCFileFormat,"%TIMESTAMP%.%timestamp:::date-subseconds% %HOSTNAME% %syslogseverity-text:::uppercase% %syslogtag%%msg:::sp-if-no-1st-sp%%msg:::drop-last-lf%\n"
$ActionFileDefaultTemplate SONiCFileFormat

#
# Set the default permissions for all log files.
#
$FileOwner root
$FileGroup adm
$FileCreateMode 0640
$DirCreateMode 0755
$Umask 0022

#
# Where to place spool and state files
#
$WorkDirectory /var/spool/rsyslog

#
# Include all config files in /etc/rsyslog.d/
#
$IncludeConfig /etc/rsyslog.d/*.conf

#
# Suppress duplicate messages and report "message repeated n times"
#
$RepeatedMsgReduction on

###############
#### RULES ####
###############
9 changes: 9 additions & 0 deletions dockers/docker-sonic-sdk/etc/rsyslog.d/supervisor.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
$ModLoad imfile

$InputFileName /var/log/supervisor/supervisord.log
$InputFileTag supervisord
$InputFileStateFile state-supervisor
$InputFileSeverity info
$InputFileFacility local0
$InputFilePersistStateInterval 1
$InputRunFileMonitor
33 changes: 33 additions & 0 deletions dockers/docker-sonic-sdk/etc/supervisor/supervisord.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
; supervisor config file

[unix_http_server]
file=/var/run/supervisor.sock ; (the path to the socket file)
chmod=0700 ; sockef file mode (default 0700)
username=dummy
password=dummy

[supervisord]
logfile=/var/log/supervisor/supervisord.log ; (main log file;default $CWD/supervisord.log)
pidfile=/var/run/supervisord.pid ; (supervisord pidfile;default supervisord.pid)
childlogdir=/var/log/supervisor ; ('AUTO' child log dir, default $TEMP)
user=root

; the below section must remain in the config file for RPC
; (supervisorctl/web interface) to work, additional interfaces may be
; added by defining them in separate rpcinterface: sections
[rpcinterface:supervisor]
supervisor.rpcinterface_factory = supervisor.rpcinterface:make_main_rpcinterface

[supervisorctl]
serverurl=unix:///var/run/supervisor.sock ; use a unix:// URL for a unix socket
username=dummy
password=dummy

; The [include] section can just contain the "files" setting. This
; setting can list multiple files (separated by whitespace or
; newlines). It can also contain wildcards. The filenames are
; interpreted as relative to this file. Included files *cannot*
; include files themselves.

[include]
files = /etc/supervisor/conf.d/*.conf
13 changes: 13 additions & 0 deletions rules/docker-sonic-sdk.mk
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# docker image for sonic_sdk

DOCKER_SONIC_SDK_STEM = docker-sonic-sdk
DOCKER_SONIC_SDK = $(DOCKER_SONIC_SDK_STEM).gz

$(DOCKER_SONIC_SDK)_DEPENDS += $(LIBSWSSCOMMON_DEV) $(LIBSAIREDIS) $(LIBSAIREDIS_DEV)

$(DOCKER_SONIC_SDK)_PATH = $(DOCKERS_PATH)/$(DOCKER_SONIC_SDK_STEM)

$(DOCKER_SONIC_SDK)_LOAD_DOCKERS += $(DOCKER_CONFIG_ENGINE_STRETCH)

SONIC_DOCKER_IMAGES += $(DOCKER_SONIC_SDK)
SONIC_STRETCH_DOCKERS += $(DOCKER_SONIC_SDK)