274d320443
Add support in dhcp_relay container for dhcp_server_ipv4 feature. HLD: sonic-net/SONiC#1282
68 lines
2.4 KiB
Django/Jinja
68 lines
2.4 KiB
Django/Jinja
{% 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
|
|
|
|
# Make apt-get non-interactive
|
|
ENV DEBIAN_FRONTEND=noninteractive
|
|
|
|
# Pass the image_version to container
|
|
ENV IMAGE_VERSION=$image_version
|
|
|
|
# Update apt's cache of available packages
|
|
RUN apt-get update
|
|
|
|
RUN apt-get install -y libjsoncpp-dev {%- if INCLUDE_DHCP_SERVER == "y" %}\
|
|
python3-dev \
|
|
build-essential{%- endif %}
|
|
|
|
{% if INCLUDE_DHCP_SERVER == "y" -%}
|
|
RUN pip3 install psutil
|
|
{%- endif %}
|
|
|
|
RUN apt-get install -y libjsoncpp-dev
|
|
|
|
{% if docker_dhcp_relay_debs.strip() -%}
|
|
# Copy built Debian packages
|
|
{{ copy_files("debs/", docker_dhcp_relay_debs.split(' '), "/debs/") }}
|
|
|
|
# Install built Debian packages and implicitly install their dependencies
|
|
{{ install_debian_packages(docker_dhcp_relay_debs.split(' ')) }}
|
|
{%- endif %}
|
|
|
|
{% if docker_dhcp_relay_whls.strip() %}
|
|
# Copy locally-built Python wheel dependencies
|
|
{{ copy_files("python-wheels/", docker_dhcp_relay_whls.split(' '), "/python-wheels/") }}
|
|
|
|
# Install locally-built Python wheel dependencies
|
|
{{ install_python_wheels(docker_dhcp_relay_whls.split(' ')) }}
|
|
{% endif %}
|
|
|
|
# Clean up
|
|
{% if INCLUDE_DHCP_SERVER == "y" -%}
|
|
RUN apt-get remove -y build-essential \
|
|
python3-dev
|
|
{%- endif %}
|
|
RUN apt-get clean -y && \
|
|
apt-get autoclean -y && \
|
|
apt-get autoremove -y && \
|
|
rm -rf /debs
|
|
|
|
COPY ["docker_init.sh", "start.sh", "/usr/bin/"]
|
|
COPY ["docker-dhcp-relay.supervisord.conf.j2", "port-name-alias-map.txt.j2", "wait_for_intf.sh.j2", "/usr/share/sonic/templates/"]
|
|
COPY ["dhcp-relay.programs.j2", "dhcpv4-relay.agents.j2", "dhcpv6-relay.agents.j2", "dhcp-relay.monitors.j2", "/usr/share/sonic/templates/"]
|
|
COPY ["files/supervisor-proc-exit-listener", "/usr/bin"]
|
|
COPY ["critical_processes", "/etc/supervisor"]
|
|
COPY ["cli", "/cli/"]
|
|
# Copy regex json and rsyslog_plugin.conf file into rsyslog.d
|
|
COPY ["*.json", "/etc/rsyslog.d/"]
|
|
COPY ["files/rsyslog_plugin.conf.j2", "/etc/rsyslog.d/"]
|
|
|
|
# Create dhcp_relay_regex.conf
|
|
RUN j2 -f json /etc/rsyslog.d/rsyslog_plugin.conf.j2 /etc/rsyslog.d/events_info.json > /etc/rsyslog.d/dhcp_relay_events.conf
|
|
RUN rm -f /etc/rsyslog.d/rsyslog_plugin.conf.j2
|
|
RUN rm -f /etc/rsyslog.d/events_info.json
|
|
|
|
ENTRYPOINT ["/usr/bin/docker_init.sh"]
|