diff --git a/platform/mellanox/docker-syncd-mlnx-rpc/Dockerfile.j2 b/platform/mellanox/docker-syncd-mlnx-rpc/Dockerfile.j2 index aaafd39f51..d9b86e7825 100644 --- a/platform/mellanox/docker-syncd-mlnx-rpc/Dockerfile.j2 +++ b/platform/mellanox/docker-syncd-mlnx-rpc/Dockerfile.j2 @@ -4,6 +4,8 @@ FROM docker-syncd-mlnx ## Make apt-get non-interactive ENV DEBIAN_FRONTEND=noninteractive +RUN apt-get purge -y syncd + {% if docker_syncd_mlnx_rpc_debs.strip() -%} # Copy locally-built Debian package dependencies {{ copy_files("debs/", docker_syncd_mlnx_rpc_debs.split(' '), "/debs/") }} @@ -20,8 +22,6 @@ ENV DEBIAN_FRONTEND=noninteractive {{ install_debian_packages(docker_syncd_mlnx_rpc_pydebs.split(' ')) }} {% endif %} -RUN apt-get purge -y syncd - ## Pre-install the fundamental packages RUN apt-get update \ && apt-get -y install \ @@ -54,4 +54,10 @@ RUN apt-get update \ COPY ["ptf_nn_agent.conf", "/etc/supervisor/conf.d/"] +## Clean up +RUN apt-get clean -y && \ + apt-get autoclean -y && \ + apt-get autoremove -y && \ + rm -rf /debs + ENTRYPOINT ["/usr/bin/supervisord"]