96ae68fedf
* Add missing pip.conf for docker-base-bookworm Signed-off-by: Saikrishna Arcot <sarcot@microsoft.com>
126 lines
4.2 KiB
Django/Jinja
126 lines
4.2 KiB
Django/Jinja
{% set prefix = DEFAULT_CONTAINER_REGISTRY %}
|
|
{% from "dockers/dockerfile-macros.j2" import install_debian_packages, install_python_wheels, copy_files %}
|
|
{% if CONFIGURED_ARCH == "armhf" and (MULTIARCH_QEMU_ENVIRON == "y" or CROSS_BUILD_ENVIRON == "y") %}
|
|
FROM --platform=linux/arm/v7 {{ prefix }}debian:bookworm
|
|
{% elif CONFIGURED_ARCH == "arm64" and (MULTIARCH_QEMU_ENVIRON == "y" or CROSS_BUILD_ENVIRON == "y") %}
|
|
FROM --platform=linux/arm64 {{ prefix }}debian:bookworm
|
|
{% else %}
|
|
FROM {{ prefix }}{{DOCKER_BASE_ARCH}}/debian:bookworm
|
|
{% endif %}
|
|
|
|
# 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 && \
|
|
rm -rf \
|
|
/usr/share/man/* \
|
|
/usr/share/groff/* \
|
|
/usr/share/info/* \
|
|
/usr/share/lintian/* \
|
|
/usr/share/linda/* \
|
|
/var/cache/man/* \
|
|
/usr/share/locale/*
|
|
|
|
# Make apt-get non-interactive
|
|
ENV DEBIAN_FRONTEND=noninteractive
|
|
|
|
# Configure data sources for apt/dpkg
|
|
COPY ["dpkg_01_drop", "/etc/dpkg/dpkg.cfg.d/01_drop"]
|
|
COPY ["sources.list.{{ CONFIGURED_ARCH }}", "/etc/apt/sources.list"]
|
|
COPY ["no_install_recommend_suggest", "/etc/apt/apt.conf.d"]
|
|
COPY ["no-check-valid-until", "/etc/apt/apt.conf.d"]
|
|
|
|
# Update apt cache and
|
|
# pre-install fundamental packages
|
|
RUN apt update && \
|
|
apt -y install \
|
|
curl \
|
|
less \
|
|
perl \
|
|
procps \
|
|
python3 \
|
|
python3-distutils \
|
|
python3-pip \
|
|
python3-setuptools \
|
|
python3-wheel \
|
|
python-is-python3 \
|
|
vim-tiny \
|
|
rsyslog \
|
|
# Install redis-tools
|
|
redis-tools \
|
|
# common dependencies
|
|
libdaemon0 \
|
|
libdbus-1-3 \
|
|
libjansson4 \
|
|
# ip and ifconfig utility missing in docker for arm arch
|
|
iproute2 \
|
|
net-tools \
|
|
# for processing/handling json files in bash environment
|
|
jq \
|
|
# for sairedis zmq rpc channel
|
|
libzmq5 \
|
|
libwrap0
|
|
|
|
# Add a config file to allow pip to install packages outside of apt/the Debian repos
|
|
COPY ["pip.conf", "/etc/pip.conf"]
|
|
|
|
# Upgrade pip via PyPI and uninstall the Debian version
|
|
RUN pip3 install --upgrade pip
|
|
RUN apt purge -y python3-pip
|
|
|
|
# For templating
|
|
RUN pip3 install j2cli
|
|
|
|
# Install supervisor
|
|
RUN pip3 install supervisor==4.2.5
|
|
|
|
# Add support for supervisord to handle startup dependencies
|
|
RUN pip3 install supervisord-dependent-startup==1.4.0
|
|
|
|
RUN mkdir -p /var/log/supervisor /etc/supervisor/conf.d
|
|
|
|
# Install gcc, libc6-dev and python3-dev for compiling python-lzf
|
|
RUN apt-get -y install build-essential libc6-dev python3-dev
|
|
|
|
# Install python-lzf
|
|
RUN pip3 install 'python-lzf==0.2.4'
|
|
|
|
# Install rdbtools
|
|
RUN pip3 install 'rdbtools==0.1.15'
|
|
|
|
# Uninstall gcc, libc6-dev and python3-dev for compiling python-lzf
|
|
RUN apt-get -y purge build-essential libc6-dev python3-dev
|
|
|
|
# Uninstall unused dependencies
|
|
RUN apt autoremove -y --purge
|
|
|
|
RUN apt-get -y purge \
|
|
exim4 \
|
|
exim4-base \
|
|
exim4-config \
|
|
exim4-daemon-light
|
|
|
|
{% if docker_base_bookworm_debs.strip() -%}
|
|
# Copy locally-built Debian package dependencies
|
|
{{ copy_files("debs/", docker_base_bookworm_debs.split(' '), "/debs/") }}
|
|
|
|
# Install built Debian packages and implicitly install their dependencies
|
|
{{ install_debian_packages(docker_base_bookworm_debs.split(' ')) }}
|
|
{%- 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 && \
|
|
rm -rf /var/lib/apt/lists/* /tmp/* ~/.cache
|
|
|
|
COPY ["etc/rsyslog.conf", "/etc/rsyslog.conf"]
|
|
COPY ["etc/rsyslog.d/*", "/etc/rsyslog.d/"]
|
|
COPY ["root/.vimrc", "/root/.vimrc"]
|
|
|
|
RUN ln /usr/bin/vim.tiny /usr/bin/vim
|
|
|
|
COPY ["etc/supervisor/supervisord.conf", "/etc/supervisor/"]
|