From 0de25a185d534bfa3ae6b7d51964173cbf3aeb82 Mon Sep 17 00:00:00 2001 From: Formartha Date: Tue, 5 Mar 2024 20:54:02 +0200 Subject: [PATCH] trying to trim down the huge image size due to CUDA --- .gitignore | 3 ++- Dockerfile | 10 +++++++--- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/.gitignore b/.gitignore index 45a4f64..e9abf5b 100644 --- a/.gitignore +++ b/.gitignore @@ -19,4 +19,5 @@ ENV/ *.jar # tmp -tmp/ \ No newline at end of file +tmp/ +.env \ No newline at end of file diff --git a/Dockerfile b/Dockerfile index e1d9a5b..09d1edf 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,4 @@ -FROM python:3.9 +FROM python:3.9-slim-bullseye WORKDIR /ai @@ -6,8 +6,12 @@ WORKDIR /ai COPY ai1899/requirements.txt requirements.txt RUN apt-get update && \ - apt-get install -y git curl && \ - pip install --no-cache-dir -r requirements.txt + apt-get install -y git curl + +# As the processing power of NVIDIA CUDA isn't always available, the incentive is to trim down the image size. +# By installing the cpu torch first, it will avoid installing the GPU related to NVIDIA CUDA. +RUN pip install --no-cache-dir torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cpu +RUN pip install --no-cache-dir -r requirements.txt # Copy the rest of the project directory into the container COPY ai1899/ .