a4405f09ed
Why I did it Support to build armhf/arm64 platforms on arm based system without qemu simulator. When building the armhf/arm64 on arm based system, it is not necessary to use qemu simulator. How I did it Build armhf on armhf system, or build arm64 on arm64 system, by default, qemu simulator will not be used. When building armhf on arm64, and you have enabled armhf docker, then it will build images without simulator automatically. It is based how the docker service is run. Docker base image change: For amd64, change from debian:to amd64/debian: For arm64, change from multiarch/debian-debootstrap:arm64- to arm64v8/debian: For armhf, change from multiarch/debian-debootstrap:armhf- to arm32v7/debian: See https://github.com/docker-library/official-images#architectures-other-than-amd64 The mapping relations: arm32v6 --- armel arm32v7 --- armhf arm64v8 --- arm64 Docker image armhf deprecated info: https://hub.docker.com/r/armhf/debian, using arm32v7 instead.
132 lines
5.0 KiB
Django/Jinja
132 lines
5.0 KiB
Django/Jinja
{% from "dockers/dockerfile-macros.j2" import install_debian_packages, install_python_wheels, copy_files %}
|
|
{% if CONFIGURED_ARCH == "armhf" and MULTIARCH_QEMU_ENVIRON == "y" %}
|
|
FROM multiarch/debian-debootstrap:armhf-buster
|
|
{% elif CONFIGURED_ARCH == "arm64" and MULTIARCH_QEMU_ENVIRON == "y" %}
|
|
FROM multiarch/debian-debootstrap:arm64-buster
|
|
{% else %}
|
|
FROM {{DOCKER_BASE_ARCH}}/debian:buster
|
|
{% 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"]
|
|
{% if CONFIGURED_ARCH == "armhf" %}
|
|
COPY ["sources.list.armhf", "/etc/apt/sources.list"]
|
|
{% elif CONFIGURED_ARCH == "arm64" %}
|
|
COPY ["sources.list.arm64", "/etc/apt/sources.list"]
|
|
{% else %}
|
|
COPY ["sources.list", "/etc/apt/sources.list"]
|
|
{% endif %}
|
|
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-get update && \
|
|
apt-get -y install \
|
|
curl \
|
|
less \
|
|
perl \
|
|
procps \
|
|
python3 \
|
|
python3-distutils \
|
|
python3-pip \
|
|
rsyslog \
|
|
vim-tiny \
|
|
# Install dependencies of redis-tools
|
|
libatomic1 \
|
|
libjemalloc2 \
|
|
liblua5.1-0 \
|
|
lua-bitop \
|
|
lua-cjson \
|
|
# 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
|
|
|
|
# Install redis-tools
|
|
{% if CONFIGURED_ARCH == "armhf" %}
|
|
RUN curl -k -o redis-tools_6.0.6-1~bpo10+1_armhf.deb "https://sonicstorage.blob.core.windows.net/packages/redis/redis-tools_6.0.6-1_bpo10+1_armhf.deb?sv=2015-04-05&sr=b&sig=67vHAMxsl%2BS3X1KsqhdYhakJkGdg5FKSPgU8kUiw4as%3D&se=2030-10-24T04%3A22%3A40Z&sp=r"
|
|
RUN dpkg -i redis-tools_6.0.6-1~bpo10+1_armhf.deb || apt-get install -f -y
|
|
RUN rm redis-tools_6.0.6-1~bpo10+1_armhf.deb
|
|
{% elif CONFIGURED_ARCH == "arm64" %}
|
|
RUN curl -o redis-tools_6.0.6-1~bpo10+1_arm64.deb "https://sonicstorage.blob.core.windows.net/packages/redis/redis-tools_6.0.6-1_bpo10+1_arm64.deb?sv=2015-04-05&sr=b&sig=GbkJV2wWln3hoz27zKi5erdk3NDKrAFrQriA97bcRCY%3D&se=2030-10-24T04%3A22%3A21Z&sp=r"
|
|
RUN dpkg -i redis-tools_6.0.6-1~bpo10+1_arm64.deb || apt-get install -f -y
|
|
RUN rm redis-tools_6.0.6-1~bpo10+1_arm64.deb
|
|
{% else %}
|
|
RUN curl -o redis-tools_6.0.6-1~bpo10+1_amd64.deb "https://sonicstorage.blob.core.windows.net/packages/redis/redis-tools_6.0.6-1~bpo10+1_amd64.deb?sv=2015-04-05&sr=b&sig=73zbmjkf3pi%2Bn0R8Hy7CWT2EUvOAyzM5aLYJWCLySGM%3D&se=2030-09-06T19%3A44%3A59Z&sp=r"
|
|
RUN dpkg -i redis-tools_6.0.6-1~bpo10+1_amd64.deb || apt-get install -f -y
|
|
RUN rm redis-tools_6.0.6-1~bpo10+1_amd64.deb
|
|
{% endif %}
|
|
|
|
# Upgrade pip via PyPI and uninstall the Debian version
|
|
RUN pip3 install --upgrade pip
|
|
RUN apt-get purge -y python3-pip
|
|
|
|
# setuptools and wheel are necessary for installing some Python wheel packages
|
|
RUN pip3 install --no-cache-dir setuptools==49.6.00
|
|
RUN pip3 install --no-cache-dir wheel==0.35.1
|
|
|
|
# For templating
|
|
RUN pip3 install j2cli
|
|
|
|
# Install supervisor
|
|
RUN pip3 install supervisor==4.2.1
|
|
|
|
# Add support for supervisord to handle startup dependencies
|
|
RUN pip3 install supervisord-dependent-startup==1.4.0
|
|
|
|
RUN mkdir -p /etc/supervisor /var/log/supervisor
|
|
|
|
RUN apt-get -y purge \
|
|
exim4 \
|
|
exim4-base \
|
|
exim4-config \
|
|
exim4-daemon-light
|
|
|
|
{% if docker_base_buster_debs.strip() -%}
|
|
# Copy locally-built Debian package dependencies
|
|
{{ copy_files("debs/", docker_base_buster_debs.split(' '), "/debs/") }}
|
|
|
|
# Install built Debian packages and implicitly install their dependencies
|
|
{{ install_debian_packages(docker_base_buster_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/*
|
|
|
|
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/"]
|