[docker-base]: Build supervisor package from source in order to update to v3.3.2 (#777)

- Resolves issue #762
This commit is contained in:
Joe LeVeque 2017-07-06 10:32:27 -07:00 committed by GitHub
parent b195b0737d
commit a697e8efcf
7 changed files with 119 additions and 33 deletions

2
.gitignore vendored
View File

@ -31,6 +31,8 @@ src/mpdecimal/*
!src/mpdecimal/Makefile !src/mpdecimal/Makefile
src/python3/* src/python3/*
!src/python3/Makefile !src/python3/Makefile
src/supervisor/*
!src/supervisor/Makefile
# Autogenerated Dockerfiles # Autogenerated Dockerfiles
dockers/docker-base/Dockerfile dockers/docker-base/Dockerfile

View File

@ -1,8 +1,9 @@
FROM debian:jessie FROM debian:jessie
## Clean documentation in FROM image # Clean documentation in FROM image
RUN find /usr/share/doc -depth \( -type f -o -type l \) ! -name copyright | xargs rm || true 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
# 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 while [ -n "$(find /usr/share/doc -depth -type d -empty -print -exec rmdir {} +)" ]; do :; done
RUN rm -rf \ RUN rm -rf \
/usr/share/man/* \ /usr/share/man/* \
@ -13,18 +14,17 @@ RUN rm -rf \
/var/cache/man/* \ /var/cache/man/* \
/usr/share/locale/* /usr/share/locale/*
## Make apt-get non-interactive # Make apt-get non-interactive
ENV DEBIAN_FRONTEND=noninteractive ENV DEBIAN_FRONTEND=noninteractive
## Configure data sources for apt/dpkg # Configure data sources for apt/dpkg
COPY ["sources.list", "/etc/apt/sources.list"] COPY ["sources.list", "/etc/apt/sources.list"]
COPY ["dpkg_01_drop", "/etc/dpkg/dpkg.cfg.d/01_drop"] COPY ["dpkg_01_drop", "/etc/dpkg/dpkg.cfg.d/01_drop"]
RUN apt-get update RUN apt-get update
## Pre-install fundamental packages # Pre-install fundamental packages
RUN apt-get -y install \ RUN apt-get -y install \
rsyslog \ rsyslog \
supervisor \
vim-tiny \ vim-tiny \
perl \ perl \
python \ python \
@ -34,25 +34,45 @@ COPY ["etc/rsyslog.conf", "/etc/rsyslog.conf"]
COPY ["etc/rsyslog.d/*", "/etc/rsyslog.d/"] COPY ["etc/rsyslog.d/*", "/etc/rsyslog.d/"]
COPY ["root/.vimrc", "/root/.vimrc"] COPY ["root/.vimrc", "/root/.vimrc"]
# Install dependencies of supervisor
RUN apt-get -y install python-pkg-resources python-meld3
RUN mkdir -p /etc/supervisor
RUN mkdir -p /var/log/supervisor
COPY ["etc/supervisor/supervisord.conf", "/etc/supervisor/"]
RUN apt-get -y purge \ RUN apt-get -y purge \
exim4 \ exim4 \
exim4-base \ exim4-base \
exim4-config \ exim4-config \
exim4-daemon-light exim4-daemon-light
{% if docker_base_dbgs %} {% if docker_base_debs.strip() -%}
## Install common debug-packages # Copy built Debian packages
RUN apt-get -y install \ {%- for deb in docker_base_debs.split(' ') %}
{% for dbg_pkg in docker_base_dbgs.split(' ') -%} COPY debs/{{ deb }} debs/
{{ dbg_pkg }}{{' '}} {%- endfor %}
# Install built Debian packages and implicitly install their dependencies
{%- for deb in docker_base_debs.split(' ') %}
RUN dpkg_apt() { [ -f $1 ] && { dpkg -i $1 || apt-get -y install -f; } || return 1; }; dpkg_apt debs/{{ deb }}
{%- endfor %}
{%- endif %}
{% if docker_base_dbgs.strip() -%}
# Install common debug-packages
{%- for dbg_pkg in docker_base_dbgs.split(' ') %}
RUN apt-get -y install {{ dbg_pkg }}
{%- endfor %} {%- endfor %}
{% else %} {% else %}
RUN ln /usr/bin/vim.tiny /usr/bin/vim RUN ln /usr/bin/vim.tiny /usr/bin/vim
{% endif %} {%- endif %}
## Clean up apt # Clean up apt
## Remove /var/lib/apt/lists/*, could be obsoleted for derived images # Remove /var/lib/apt/lists/*, could be obsoleted for derived images
RUN apt-get clean -y; apt-get autoclean -y; apt-get autoremove -y; \ RUN apt-get clean -y; apt-get autoclean -y; apt-get autoremove -y
rm -rf /var/lib/apt/lists/*; \ RUN rm -rf /var/lib/apt/lists/*
rm -rf /tmp/*;
RUN rm -rf /tmp/*

View File

@ -0,0 +1,28 @@
; supervisor config file
[unix_http_server]
file=/var/run/supervisor.sock ; (the path to the socket file)
chmod=0700 ; sockef file mode (default 0700)
[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)
; 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
; 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

View File

@ -2,6 +2,7 @@
DOCKER_BASE = docker-base.gz DOCKER_BASE = docker-base.gz
$(DOCKER_BASE)_PATH = $(DOCKERS_PATH)/docker-base $(DOCKER_BASE)_PATH = $(DOCKERS_PATH)/docker-base
$(DOCKER_BASE)_DEPENDS += $(SUPERVISOR)
ifeq ($(SONIC_CONFIG_DEBUG),y) ifeq ($(SONIC_CONFIG_DEBUG),y)
GDB = gdb GDB = gdb

5
rules/supervisor.mk Normal file
View File

@ -0,0 +1,5 @@
# supervisor package
SUPERVISOR = python-supervisor_3.3.2-1_all.deb
$(SUPERVISOR)_SRC_PATH = $(SRC_PATH)/supervisor
SONIC_MAKE_DEBS += $(SUPERVISOR)

View File

@ -200,23 +200,31 @@ RUN apt-get update && apt-get install -y \
procmail \ procmail \
# For gtest # For gtest
libgtest-dev \ libgtest-dev \
cmake \ cmake
# For linux build
&& apt-get -y build-dep linux \
# For gobgp build
&& apt-get -yt jessie-backports install \
golang-go \
golang-github-golang-mock-dev \
# For p4 build
&& pip install \
ctypesgen \
crc16 \
# For templating
j2cli \
# For sonic config engine testing
pyangbind
# Install dependencies for building isc-dhcp-relay # For linux build
RUN apt-get -y build-dep linux
# For gobgp build
RUN apt-get -yt jessie-backports install \
golang-go \
golang-github-golang-mock-dev
# For p4 build
RUN pip install \
ctypesgen \
crc16
# For templating
RUN pip install j2cli
# For sonic config engine testing
RUN pip install pyangbind
# For supervisor build
RUN pip install meld3 mock
# Install dependencies for isc-dhcp-relay build
RUN apt-get -y build-dep isc-dhcp RUN apt-get -y build-dep isc-dhcp
RUN cd /usr/src/gtest && cmake . && make -C /usr/src/gtest RUN cd /usr/src/gtest && cmake . && make -C /usr/src/gtest

22
src/supervisor/Makefile Normal file
View File

@ -0,0 +1,22 @@
.ONESHELL:
SHELL = /bin/bash
.SHELLFLAGS += -e
MAIN_TARGET = python-supervisor_3.3.2-1_all.deb
$(addprefix $(DEST)/, $(MAIN_TARGET)): $(DEST)/% :
# Remove any stale files
rm -rf ./supervisor
# Clone isc-dhcp repo
git clone git://github.com/Supervisor/supervisor.git
pushd ./supervisor
git checkout -f 3.3.2
# Build Python and Debian package
python setup.py --command-packages=stdeb.command bdist_deb
popd
# Move the newly-built .deb packages to the destination directory
mv ./supervisor/deb_dist/$* $(DEST)/