Skip to content

Commit

Permalink
Build supervisor package from v3.3.2 tag and install in docker-base
Browse files Browse the repository at this point in the history
  • Loading branch information
jleveque committed Jun 29, 2017
1 parent 39bd495 commit a84fd37
Show file tree
Hide file tree
Showing 6 changed files with 76 additions and 26 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@ src/mpdecimal/*
!src/mpdecimal/Makefile
src/python3/*
!src/python3/Makefile
src/supervisor/*
!src/supervisor/Makefile

# Autogenerated Dockerfiles
dockers/docker-base/Dockerfile
Expand Down
46 changes: 29 additions & 17 deletions dockers/docker-base/Dockerfile.j2
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
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
## 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 rm -rf \
/usr/share/man/* \
Expand All @@ -13,18 +14,17 @@ RUN rm -rf \
/var/cache/man/* \
/usr/share/locale/*

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

## Configure data sources for apt/dpkg
# Configure data sources for apt/dpkg
COPY ["sources.list", "/etc/apt/sources.list"]
COPY ["dpkg_01_drop", "/etc/dpkg/dpkg.cfg.d/01_drop"]
RUN apt-get update

## Pre-install fundamental packages
# Pre-install fundamental packages
RUN apt-get -y install \
rsyslog \
supervisor \
vim-tiny \
perl \
python \
Expand All @@ -40,19 +40,31 @@ RUN apt-get -y purge \
exim4-config \
exim4-daemon-light

{% if docker_base_dbgs %}
## Install common debug-packages
RUN apt-get -y install \
{% for dbg_pkg in docker_base_dbgs.split(' ') -%}
{{ dbg_pkg }}{{' '}}
{% if docker_base_debs.strip() -%}
# Copy built Debian packages
{%- for deb in docker_base_debs.split(' ') %}
COPY debs/{{ deb }} debs/
{%- 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 %}
{% else %}
RUN ln /usr/bin/vim.tiny /usr/bin/vim
{% endif %}
{%- endif %}

# 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
RUN rm -rf /var/lib/apt/lists/*

## 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/*;
RUN rm -rf /tmp/*

1 change: 1 addition & 0 deletions rules/docker-base.mk
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

DOCKER_BASE = docker-base.gz
$(DOCKER_BASE)_PATH = $(DOCKERS_PATH)/docker-base
$(DOCKER_BASE)_DEPENDS += $(SUPERVISOR)

ifeq ($(SONIC_CONFIG_DEBUG),y)
GDB = gdb
Expand Down
5 changes: 5 additions & 0 deletions rules/supervisor.mk
Original file line number Diff line number Diff line change
@@ -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)
26 changes: 17 additions & 9 deletions sonic-slave/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -200,23 +200,31 @@ RUN apt-get update && apt-get install -y \
procmail \
# For gtest
libgtest-dev \
cmake \
cmake

# For linux build
&& apt-get -y build-dep linux \
RUN apt-get -y build-dep linux

# For gobgp build
&& apt-get -yt jessie-backports install \
RUN apt-get -yt jessie-backports install \
golang-go \
golang-github-golang-mock-dev \
golang-github-golang-mock-dev

# For p4 build
&& pip install \
RUN pip install \
ctypesgen \
crc16 \
crc16

# For templating
j2cli \
RUN pip install j2cli

# For sonic config engine testing
pyangbind
RUN pip install pyangbind

# For supervisor build
RUN pip install meld3 mock

# Install dependencies for building isc-dhcp-relay
# Install dependencies for isc-dhcp-relay build
RUN apt-get -y build-dep isc-dhcp

RUN cd /usr/src/gtest && cmake . && make -C /usr/src/gtest
Expand Down
22 changes: 22 additions & 0 deletions src/supervisor/Makefile
Original file line number Diff line number Diff line change
@@ -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)/

0 comments on commit a84fd37

Please sign in to comment.