From 231e36e3303b23cc0262962c417ed76683bd3f9f Mon Sep 17 00:00:00 2001 From: Laurent Sorber Date: Mon, 11 Sep 2023 08:58:08 +0200 Subject: [PATCH] feat: optimize Docker image size (#6) --- Dockerfile | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/Dockerfile b/Dockerfile index c5e571c..068d316 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,6 +1,6 @@ # syntax=docker/dockerfile:1 ARG PYTHON_VERSION=3.8 -FROM python:$PYTHON_VERSION-slim AS base +FROM python:$PYTHON_VERSION-slim # Install wget. RUN apt-get update && \ @@ -11,7 +11,8 @@ RUN apt-get update && \ # Install Miniconda. RUN CONDA_ARCH=$([ "$TARGETARCH" = "arm64" ] && echo "aarch64" || echo "x86_64") && \ wget --quiet "https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-$CONDA_ARCH.sh" --output-document ~/miniconda.sh && \ - /bin/bash ~/miniconda.sh -b -p /opt/conda + /bin/bash ~/miniconda.sh -b -p /opt/conda && \ + rm ~/miniconda.sh ENV PATH=/opt/conda/bin:$PATH ENV LD_LIBRARY_PATH=/opt/conda/lib:$LD_LIBRARY_PATH @@ -20,4 +21,5 @@ ARG CUDA_VERSION=11.8 ARG CUDNN_VERSION=8.8 RUN conda install --name base conda-libmamba-solver && \ conda config --set solver libmamba && \ - conda install --channel conda-forge --yes cudatoolkit="$CUDA_VERSION" cudnn="$CUDNN_VERSION" + conda install --name base --channel conda-forge --yes cudatoolkit="$CUDA_VERSION" cudnn="$CUDNN_VERSION" && \ + conda clean --all --force-pkgs-dirs --yes