From e1e5370413dbb4546a069d9e2e56522827d77bc6 Mon Sep 17 00:00:00 2001 From: Stan Girard Date: Fri, 18 Aug 2023 12:56:50 +0200 Subject: [PATCH] feat(docker): improved size image --- backend/core/Dockerfile | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/backend/core/Dockerfile b/backend/core/Dockerfile index f220df64888d..b481cedc6e94 100644 --- a/backend/core/Dockerfile +++ b/backend/core/Dockerfile @@ -1,14 +1,19 @@ -FROM python:3.11-bullseye +# Using a slim version for a smaller base image +FROM python:3.11-slim-bullseye -# Install GEOS library -RUN apt-get update && apt-get install -y libgeos-dev pandoc +# Install GEOS library and clean up in one step +RUN apt-get update && apt-get install -y libgeos-dev pandoc && \ + rm -rf /var/lib/apt/lists/* && apt-get clean WORKDIR /code -COPY ./requirements.txt /code/requirements.txt +# Copy just the requirements first +COPY ./requirements.txt . -RUN pip install --no-cache-dir -r /code/requirements.txt --timeout 100 +# Increase timeout might not be necessary but is retained as in original +RUN pip install --no-cache-dir -r requirements.txt --timeout 100 -COPY . /code +# Copy the rest of the application +COPY . . CMD ["uvicorn", "main:app", "--reload", "--host", "0.0.0.0", "--port", "5050"]