2023-09-11 11:15:56 -05:00
|
|
|
{% from "dockers/dockerfile-macros.j2" import install_debian_packages, install_python_wheels, copy_files %}
|
|
|
|
FROM docker-config-engine-bullseye-{{DOCKER_USERNAME}}:{{DOCKER_USERTAG}}
|
|
|
|
|
|
|
|
ARG docker_container_name
|
|
|
|
ARG image_version
|
2023-10-20 11:52:05 -05:00
|
|
|
RUN [ -f /etc/rsyslog.conf ] && sed -ri "s/%syslogtag%/$docker_container_name#%syslogtag%/;" /etc/rsyslog.conf
|
2023-09-11 11:15:56 -05:00
|
|
|
|
|
|
|
## Make apt-get non-interactive
|
|
|
|
ENV DEBIAN_FRONTEND=noninteractive
|
|
|
|
|
|
|
|
# Pass the image_version to container
|
|
|
|
ENV IMAGE_VERSION=$image_version
|
|
|
|
|
|
|
|
RUN apt-get update && \
|
|
|
|
apt-get install -f -y \
|
|
|
|
tcpdump \
|
2023-10-20 11:52:05 -05:00
|
|
|
python3-dev \
|
2023-09-11 11:15:56 -05:00
|
|
|
# For kea build environment
|
|
|
|
automake \
|
|
|
|
libtool \
|
|
|
|
pkg-config \
|
|
|
|
build-essential \
|
|
|
|
ccache \
|
|
|
|
# For kea dependancies
|
|
|
|
libboost-dev \
|
|
|
|
libboost-system-dev \
|
|
|
|
liblog4cplus-dev \
|
|
|
|
libssl-dev
|
|
|
|
|
|
|
|
# Install kea from source
|
|
|
|
RUN apt-get install -f -y devscripts
|
|
|
|
RUN mkdir kea && cd kea && dget -u http://deb.debian.org/debian/pool/main/i/isc-kea/isc-kea_2.2.0-6.dsc
|
|
|
|
RUN cd /kea/isc-kea-2.2.0 && autoreconf --install && ./configure --disable-FEATURE \
|
|
|
|
--enable-static=no --disable-install-configurations --enable-pgsql-ssl=no --with-PACKAGE=no \
|
|
|
|
&& make -j$(nproc) && make install
|
|
|
|
# Create run folder for kea
|
|
|
|
RUN mkdir -p /run/kea
|
|
|
|
# Create config folder for kea
|
|
|
|
RUN mkdir -p /etc/kea
|
|
|
|
# Remove stuff we don't need to reduce image size
|
|
|
|
RUN cd /usr/local/lib && rm -v *.la && rm -v kea/hooks/*.la
|
|
|
|
# Strip debug symbols to reduce file size of binaries
|
|
|
|
Run find /usr/local/sbin/ /usr/local/lib/ -type f -exec strip --strip-unneeded {} \;
|
|
|
|
# Remove source code
|
|
|
|
RUN rm -rf /kea
|
|
|
|
RUN echo "/usr/local/lib/kea/hooks" > /etc/ld.so.conf.d/kea.conf && \
|
|
|
|
ldconfig
|
|
|
|
# Remove sbin we don't need
|
|
|
|
RUN cd /usr/local/sbin && rm -f kea-admin kea-ctrl-agent kea-dhcp-ddns kea-dhcp6 keactrl
|
|
|
|
# Remove hook lib we don't need
|
|
|
|
RUN cd /usr/local/lib/kea/hooks && rm -f libdhcp_bootp.so libdhcp_flex_option.so libdhcp_stat_cmds.so
|
2023-10-20 11:52:05 -05:00
|
|
|
RUN pip3 install psutil
|
|
|
|
# TODO issue on remote rsyslog server in non-host container
|
|
|
|
RUN rm -f /etc/supervisor/conf.d/containercfgd.conf
|
2023-09-11 11:15:56 -05:00
|
|
|
|
|
|
|
{% if docker_dhcp_server_debs.strip() -%}
|
|
|
|
# Copy locally-built Debian package dependencies
|
|
|
|
{{ copy_files("debs/", docker_dhcp_server_debs.split(' '), "/debs/") }}
|
|
|
|
|
|
|
|
# Install locally-built Debian packages and implicitly install their dependencies
|
|
|
|
{{ install_debian_packages(docker_dhcp_server_debs.split(' ')) }}
|
|
|
|
{%- endif %}
|
|
|
|
|
2023-10-20 11:52:05 -05:00
|
|
|
{% if docker_dhcp_server_whls.strip() %}
|
|
|
|
# Copy locally-built Python wheel dependencies
|
|
|
|
{{ copy_files("python-wheels/", docker_dhcp_server_whls.split(' '), "/python-wheels/") }}
|
|
|
|
|
|
|
|
# Install locally-built Python wheel dependencies
|
|
|
|
{{ install_python_wheels(docker_dhcp_server_whls.split(' ')) }}
|
|
|
|
{% endif %}
|
|
|
|
|
2023-09-11 11:15:56 -05:00
|
|
|
# Remove build stuff we don't need
|
|
|
|
RUN apt-get remove -y devscripts \
|
|
|
|
automake \
|
|
|
|
libtool \
|
|
|
|
pkg-config \
|
|
|
|
build-essential \
|
2023-10-20 11:52:05 -05:00
|
|
|
python3-dev \
|
2023-09-11 11:15:56 -05:00
|
|
|
ccache
|
|
|
|
|
|
|
|
RUN apt-get clean -y && \
|
|
|
|
apt-get autoclean -y && \
|
|
|
|
apt-get autoremove -y && \
|
|
|
|
rm -rf /debs
|
|
|
|
|
2023-10-20 11:52:05 -05:00
|
|
|
COPY ["docker_init.sh", "start.sh", "/usr/bin/"]
|
2023-09-11 11:15:56 -05:00
|
|
|
COPY ["supervisord.conf", "/etc/supervisor/conf.d/"]
|
|
|
|
COPY ["files/supervisor-proc-exit-listener", "/usr/bin"]
|
2023-10-20 11:52:05 -05:00
|
|
|
COPY ["port-name-alias-map.txt.j2", "rsyslog/rsyslog.conf.j2", "kea-dhcp4.conf.j2", "/usr/share/sonic/templates/"]
|
2023-09-11 11:15:56 -05:00
|
|
|
COPY ["critical_processes", "/etc/supervisor/"]
|
2023-10-20 11:52:05 -05:00
|
|
|
COPY ["lease_update.sh", "/etc/kea/"]
|
|
|
|
COPY ["kea-dhcp4-init.conf", "/etc/kea/kea-dhcp4.conf"]
|
2023-09-11 11:15:56 -05:00
|
|
|
COPY ["cli", "/cli/"]
|
2023-10-20 11:52:05 -05:00
|
|
|
COPY ["rsyslog/default.conf", "/etc/rsyslog.d"]
|
2023-09-11 11:15:56 -05:00
|
|
|
|
|
|
|
ENTRYPOINT ["/usr/bin/docker_init.sh"]
|