diff --git a/.gitmodules b/.gitmodules index 35e7290b8000..e1aadb513071 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,6 +1,3 @@ -[submodule "docker-base"] - path = dockers/docker-base - url = https://github.com/Azure/sonic-docker-base.git [submodule "sonic-swss-common"] path = src/sonic-swss-common url = https://github.com/Azure/sonic-swss-common diff --git a/dockers/docker-base b/dockers/docker-base deleted file mode 160000 index 4b42689e8c5b..000000000000 --- a/dockers/docker-base +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 4b42689e8c5b14deda6ef64a287e4641bd999bf5 diff --git a/dockers/docker-base/Dockerfile b/dockers/docker-base/Dockerfile new file mode 100644 index 000000000000..b5f6b7c855c5 --- /dev/null +++ b/dockers/docker-base/Dockerfile @@ -0,0 +1,41 @@ +FROM debian:jessie + +## Clean documentation in FROM image +RUN find /usr/share/doc -depth \( -type f -o -type l \) ! -name copyright | xargs rm || true +## Clean doc directories that are empty or only contain empty directories +RUN while [ -n "$(find /usr/share/doc -depth -type d -empty -print -exec rmdir {} +)" ]; do :; done +RUN rm -rf \ + /usr/share/man/* \ + /usr/share/groff/* \ + /usr/share/info/* \ + /usr/share/lintian/* \ + /usr/share/linda/* \ + /var/cache/man/* \ + /usr/share/locale/* + +## Set the apt source +COPY sources.list /etc/apt/sources.list +COPY dpkg_01_drop /etc/dpkg/dpkg.cfg.d/01_drop +RUN apt-get clean && apt-get update + +## Pre-install the fundamental packages +RUN apt-get -y install \ + rsyslog \ + vim-tiny \ + perl \ + python + +COPY rsyslog.conf /etc/rsyslog.conf + +RUN apt-get -y purge \ + exim4 \ + exim4-base \ + exim4-config \ + exim4-daemon-light + +## Clean up apt +## Remove /var/lib/apt/lists/*, could be obsoleted for derived images +RUN apt-get clean -y; apt-get autoclean -y; apt-get autoremove -y; \ + rm -rf /var/lib/apt/lists/*; \ + rm -rf /tmp/*; + diff --git a/dockers/docker-base/LICENSE b/dockers/docker-base/LICENSE new file mode 100644 index 000000000000..1d7131f729e9 --- /dev/null +++ b/dockers/docker-base/LICENSE @@ -0,0 +1,14 @@ +Copyright 2016 Microsoft, Inc. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. + diff --git a/dockers/docker-base/dpkg_01_drop b/dockers/docker-base/dpkg_01_drop new file mode 100644 index 000000000000..e75ef3147158 --- /dev/null +++ b/dockers/docker-base/dpkg_01_drop @@ -0,0 +1,22 @@ +## Drop unnecessary files +## ref: https://wiki.ubuntu.com/ReducingDiskFootprint + +## Documentation +path-exclude /usr/share/doc/* +# we need to keep copyright files for legal reasons +path-include /usr/share/doc/*/copyright +path-exclude /usr/share/man/* +path-exclude /usr/share/groff/* +path-exclude /usr/share/info/* +# lintian stuff is small, but really unnecessary +path-exclude /usr/share/lintian/* +path-exclude /usr/share/linda/* + +## Translations +path-exclude /usr/share/locale/* + +## Landscape +path-exclude /usr/share/pyshared/twisted/test* +path-exclude /usr/lib/python*/dist-packages/twisted/test* +path-exclude /usr/share/pyshared/twisted/*/test* +path-exclude /usr/lib/python*/dist-packages/twisted/*/test* diff --git a/dockers/docker-base/rsyslog.conf b/dockers/docker-base/rsyslog.conf new file mode 100644 index 000000000000..e03df1f741c2 --- /dev/null +++ b/dockers/docker-base/rsyslog.conf @@ -0,0 +1,68 @@ +############################################################################### +# Managed by Ansible +# file: ansible/roles/acs/templates/rsyslog.conf.j2 +############################################################################### +# +# /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 +#$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 +*.* @127.0.0.1:514 + +# +# Use traditional timestamp format. +# To enable high precision timestamps, comment out the following line. +# +#$ActionFileDefaultTemplate RSYSLOG_TraditionalFileFormat + +# Define a custom template +$template ACSFileFormat,"%TIMESTAMP% %HOSTNAME% %syslogseverity-text:::uppercase% %syslogtag%%msg:::sp-if-no-1st-sp%%msg:::drop-last-lf%\n" +$ActionFileDefaultTemplate ACSFileFormat + +# +# 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 + + +############### +#### RULES #### +############### + diff --git a/dockers/docker-base/sources.list b/dockers/docker-base/sources.list new file mode 100644 index 000000000000..2ed195cff416 --- /dev/null +++ b/dockers/docker-base/sources.list @@ -0,0 +1,7 @@ +## Debian mirror on Microsoft Azure +## Ref: http://debian-archive.trafficmanager.net/ + +deb http://debian-archive.trafficmanager.net/debian/ jessie main contrib non-free +deb-src http://debian-archive.trafficmanager.net/debian/ jessie main contrib non-free +deb http://debian-archive.trafficmanager.net/debian-security/ jessie/updates main contrib non-free +deb-src http://debian-archive.trafficmanager.net/debian-security/ jessie/updates main contrib non-free