Skip to content

Commit

Permalink
Marvell: Update Dockerfiles for staged builds
Browse files Browse the repository at this point in the history
  • Loading branch information
krismarvell committed Sep 5, 2024
1 parent 61be6bc commit 140e08e
Show file tree
Hide file tree
Showing 6 changed files with 75 additions and 66 deletions.
9 changes: 8 additions & 1 deletion platform/innovium/docker-saiserver-invm/Dockerfile.j2
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
{% from "dockers/dockerfile-macros.j2" import install_debian_packages %}
FROM docker-config-engine-bookworm-{{DOCKER_USERNAME}}:{{DOCKER_USERTAG}}
ARG BASE=docker-config-engine-bookworm-{{DOCKER_USERNAME}}:{{DOCKER_USERTAG}}

FROM $BASE as base

ARG docker_container_name

Expand Down Expand Up @@ -38,4 +40,9 @@ COPY ["supervisord.conf", "/etc/supervisor/conf.d/"]
RUN apt-get clean -y; apt-get autoclean -y; apt-get autoremove -y
RUN rm -rf /debs

FROM $BASE

COPY --from=base / /

ENV DEBIAN_FRONTEND=noninteractive
ENTRYPOINT ["/usr/local/bin/supervisord"]
36 changes: 15 additions & 21 deletions platform/innovium/docker-syncd-invm-rpc/Dockerfile.j2
Original file line number Diff line number Diff line change
@@ -1,15 +1,11 @@
FROM docker-syncd-invm-{{DOCKER_USERNAME}}:{{DOCKER_USERTAG}}
{% from "dockers/dockerfile-macros.j2" import install_python_wheels, copy_files %}
{% from "dockers/dockerfile-macros.j2" import install_debian_packages, install_python_wheels, copy_files %}
ARG BASE=docker-syncd-invm-{{DOCKER_USERNAME}}:{{DOCKER_USERTAG}}

FROM $BASE as base

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

COPY \
{% for deb in docker_syncd_invm_rpc_debs.split(' ') -%}
debs/{{ deb }}{{' '}}
{%- endfor -%}
debs/

RUN apt-get purge -y syncd

## Pre-install the fundamental packages
Expand All @@ -33,10 +29,6 @@ RUN apt-get update \
libnanomsg5 \
libnanomsg-dev

RUN dpkg_apt() { [ -f $1 ] && { dpkg -i $1 || apt-get -y install -f; } || return 1; } ; \
{% for deb in docker_syncd_invm_rpc_debs.split(' ') -%}
dpkg_apt debs/{{ deb }}{{'; '}}
{%- endfor %}

RUN pip3 install cffi \
&& pip3 install nnpy \
Expand All @@ -46,19 +38,21 @@ RUN pip3 install cffi \

COPY ["ptf_nn_agent.conf", "/etc/supervisor/conf.d/"]

{% if docker_syncd_invm_rpc_whls.strip() -%}
# Copy locally-built Python wheel dependencies
{{ copy_files("python-wheels/", docker_syncd_invm_rpc_whls.split(' '), "/python-wheels/") }}

# Install locally-built Python wheel dependencies
{{ install_python_wheels(docker_syncd_invm_rpc_whls.split(' ')) }}
{% endif %}

{% if docker_syncd_invm_rpc_debs.strip() -%}
# Copy built Debian packages
{{ copy_files("debs/", docker_syncd_invm_rpc_debs.split(' '), "/debs/") }}
# Install built Debian packages and implicitly install their dependencies
{{ install_debian_packages(docker_syncd_invm_rpc_debs.split(' ')) }}
{%- endif %}

## Clean up
RUN apt-get purge -y libyaml-dev python3-dev libffi-dev libssl-dev wget cmake \
build-essential
RUN apt-get clean -y; apt-get autoclean -y; apt-get autoremove -y
RUN rm -rf /root/deps

FROM $BASE

COPY --from=base / /

ENV DEBIAN_FRONTEND=noninteractive
ENTRYPOINT ["/usr/local/bin/supervisord"]
30 changes: 15 additions & 15 deletions platform/innovium/docker-syncd-invm/Dockerfile.j2
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
{% from "dockers/dockerfile-macros.j2" import install_debian_packages %}
FROM docker-config-engine-bookworm-{{DOCKER_USERNAME}}:{{DOCKER_USERTAG}}
{% from "dockers/dockerfile-macros.j2" import install_debian_packages, install_python_wheels, copy_files %}
ARG BASE=docker-config-engine-bookworm-{{DOCKER_USERNAME}}:{{DOCKER_USERTAG}}

FROM $BASE as base

ARG docker_container_name

Expand All @@ -8,12 +10,6 @@ ENV DEBIAN_FRONTEND=noninteractive

RUN apt-get update

COPY \
{% for deb in docker_syncd_invm_debs.split(' ') -%}
debs/{{ deb }}{{' '}}
{%- endfor -%}
debs/

# Needed for Innovium Debug Shell
RUN apt-get install -y net-tools
RUN apt-get install -y libjansson4
Expand All @@ -22,19 +18,23 @@ RUN apt-get install -y binutils
RUN pip3 install numpy
RUN pip3 install yamlordereddictloader

RUN dpkg -i \
{% for deb in docker_syncd_invm_debs.split(' ') -%}
debs/{{ deb }}{{' '}}
{%- endfor %}
{% if docker_syncd_invm_debs.strip() -%}
# Copy locally-built Debian package dependencies
{{ copy_files("debs/", docker_syncd_invm_debs.split(' '), "/debs/") }}

# Install locally-built Debian packages and implicitly install their dependencies
{{ install_debian_packages(docker_syncd_invm_debs.split(' ')) }}
{%- endif %}

COPY ["start.sh", "/usr/bin/"]
COPY ["ivm_start.sh", "/usr/bin/"]
COPY ["supervisord.conf", "/etc/supervisor/conf.d/"]
COPY ["files/supervisor-proc-exit-listener", "/usr/bin"]
COPY ["critical_processes", "/etc/supervisor/"]

## Clean up
RUN apt-get clean -y; apt-get autoclean -y; apt-get autoremove -y
RUN rm -rf /debs
FROM $BASE

COPY --from=base / /

ENV DEBIAN_FRONTEND=noninteractive
ENTRYPOINT ["/usr/local/bin/supervisord"]
9 changes: 8 additions & 1 deletion platform/marvell/docker-saiserver-mrvl/Dockerfile.j2
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
{% from "dockers/dockerfile-macros.j2" import install_debian_packages %}
FROM docker-config-engine-bookworm-{{DOCKER_USERNAME}}:{{DOCKER_USERTAG}}
ARG BASE=docker-config-engine-bookworm-{{DOCKER_USERNAME}}:{{DOCKER_USERTAG}}

FROM $BASE as base

ARG docker_container_name

Expand Down Expand Up @@ -32,4 +34,9 @@ COPY ["supervisord.conf", "/etc/supervisor/conf.d/"]
RUN apt-get clean -y; apt-get autoclean -y; apt-get autoremove -y
RUN rm -rf /debs

FROM $BASE

COPY --from=base / /

ENV DEBIAN_FRONTEND=noninteractive
ENTRYPOINT ["/usr/local/bin/supervisord"]
28 changes: 15 additions & 13 deletions platform/marvell/docker-syncd-mrvl-rpc/Dockerfile.j2
Original file line number Diff line number Diff line change
@@ -1,15 +1,11 @@
FROM docker-syncd-mrvl-{{DOCKER_USERNAME}}:{{DOCKER_USERTAG}}
{% from "dockers/dockerfile-macros.j2" import install_python_wheels, copy_files %}
{% from "dockers/dockerfile-macros.j2" import install_debian_packages, install_python_wheels, copy_files %}
ARG BASE=docker-syncd-mrvl-{{DOCKER_USERNAME}}:{{DOCKER_USERTAG}}

FROM $BASE as base

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

COPY \
{% for deb in docker_syncd_mrvl_rpc_debs.split(' ') -%}
debs/{{ deb }}{{' '}}
{%- endfor -%}
debs/

RUN apt-get purge -y syncd

## Pre-install the fundamental packages
Expand All @@ -30,10 +26,12 @@ RUN apt-get update \
libnanomsg5 \
libnanomsg-dev

RUN dpkg_apt() { [ -f $1 ] && { dpkg -i $1 || apt-get -y install -f; } || return 1; } ; \
{% for deb in docker_syncd_mrvl_rpc_debs.split(' ') -%}
dpkg_apt debs/{{ deb }}{{'; '}}
{%- endfor %}
{% if docker_syncd_mrvl_rpc_debs.strip() -%}
# Copy built Debian packages
{{ copy_files("debs/", docker_syncd_mrvl_rpc_debs.split(' '), "/debs/") }}
# Install built Debian packages and implicitly install their dependencies
{{ install_debian_packages(docker_syncd_mrvl_rpc_debs.split(' ')) }}
{%- endif %}

RUN pip3 install cffi \
&& pip3 install nnpy \
Expand All @@ -53,7 +51,11 @@ COPY ["ptf_nn_agent.conf", "/etc/supervisor/conf.d/"]

## Clean up
RUN apt-get purge -y libyaml-dev python3-dev libffi-dev libssl-dev wget build-essential
RUN apt-get clean -y; apt-get autoclean -y; apt-get autoremove -y
RUN rm -rf /root/deps

FROM $BASE

COPY --from=base / /

ENV DEBIAN_FRONTEND=noninteractive
ENTRYPOINT ["/usr/local/bin/supervisord"]
29 changes: 14 additions & 15 deletions platform/marvell/docker-syncd-mrvl/Dockerfile.j2
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
{% from "dockers/dockerfile-macros.j2" import install_debian_packages %}
FROM docker-config-engine-bookworm-{{DOCKER_USERNAME}}:{{DOCKER_USERTAG}}
{% from "dockers/dockerfile-macros.j2" import install_debian_packages, copy_files %}
ARG BASE=docker-config-engine-bookworm-{{DOCKER_USERNAME}}:{{DOCKER_USERTAG}}

FROM $BASE as base

ARG docker_container_name

Expand All @@ -8,30 +10,27 @@ ENV DEBIAN_FRONTEND=noninteractive

RUN apt-get update

COPY \
{% for deb in docker_syncd_mrvl_debs.split(' ') -%}
debs/{{ deb }}{{' '}}
{%- endfor -%}
debs/

RUN apt-get update \
&& apt-get -y install \
net-tools \
iputils-ping

RUN apt-get -y install libpcap-dev libxml2-dev python3-dev swig

RUN dpkg -i \
{% for deb in docker_syncd_mrvl_debs.split(' ') -%}
debs/{{ deb }}{{' '}}
{%- endfor %}
{% if docker_syncd_mrvl_debs.strip() -%}
# Copy locally-built Debian package dependencies
{{ copy_files("debs/", docker_syncd_mrvl_debs.split(' '), "/debs/") }}
# Install locally-built Debian packages and implicitly install their dependencies
{{ install_debian_packages(docker_syncd_mrvl_debs.split(' ')) }}
{%- endif %}

COPY ["supervisord.conf", "/etc/supervisor/conf.d/"]
COPY ["files/supervisor-proc-exit-listener", "/usr/bin/"]
COPY ["critical_processes", "/etc/supervisor/"]

## Clean up
RUN apt-get clean -y; apt-get autoclean -y; apt-get autoremove -y
RUN rm -rf /debs
FROM $BASE

COPY --from=base / /

ENV DEBIAN_FRONTEND=noninteractive
ENTRYPOINT ["/usr/local/bin/supervisord"]

0 comments on commit 140e08e

Please sign in to comment.