From c4e60d71bc2190fa62be77ac3330adb79f402dda Mon Sep 17 00:00:00 2001 From: Gabriel Luiz Freitas Almeida Date: Thu, 16 May 2024 00:27:07 -0300 Subject: [PATCH] Upgrade Python base image to 3.12 and add gcc as dependency (#1908) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * 🔧 (build_and_push.Dockerfile): Upgrade Python base image from 3.10 to 3.12 for compatibility and updated dependencies 🔧 (build_and_push.Dockerfile): Add gcc to the list of dependencies for building Python dependencies 🔧 (build_and_push.Dockerfile): Update pip install command to specify the exact path for the .tar.gz file 🔧 (build_and_push_base.Dockerfile): Upgrade Python base image from 3.10 to 3.12 for compatibility and updated dependencies 🔧 (build_and_push_base.Dockerfile): Add gcc to the list of dependencies for building Python dependencies 🔧 (build_and_push_base.Dockerfile): Update pip install command to specify the exact path for the .tar.gz file * Merge remote-tracking branch 'origin/dev' into fix_docker_images --- build_and_push.Dockerfile | 18 ++++++++++-------- build_and_push_base.Dockerfile | 12 +++++------- 2 files changed, 15 insertions(+), 15 deletions(-) diff --git a/build_and_push.Dockerfile b/build_and_push.Dockerfile index f552dd695..e27599454 100644 --- a/build_and_push.Dockerfile +++ b/build_and_push.Dockerfile @@ -10,7 +10,7 @@ # PYTHON-BASE # Sets up all our shared environment variables ################################ -FROM python:3.10-slim as python-base +FROM python:3.12-slim as python-base # python ENV PYTHONUNBUFFERED=1 \ @@ -47,7 +47,7 @@ ENV PATH="$POETRY_HOME/bin:$VENV_PATH/bin:$PATH" # Used to build deps + create our virtual environment ################################ FROM python-base as builder-base -RUN + RUN apt-get update \ && apt-get install --no-install-recommends -y \ # deps for installing poetry @@ -55,7 +55,12 @@ RUN apt-get update \ # deps for building python deps build-essential \ # npm - npm + npm \ + # gcc + gcc \ + && apt-get clean \ + && rm -rf /var/lib/apt/lists/* + # Now we need to copy the entire project into the image @@ -70,15 +75,12 @@ RUN --mount=type=cache,target=/root/.cache \ RUN python -m pip install requests && cd ./scripts && python update_dependencies.py RUN $POETRY_HOME/bin/poetry lock RUN $POETRY_HOME/bin/poetry build -# Final stage for the application -FROM python-base as final # Copy virtual environment and built .tar.gz from builder base RUN useradd -m -u 1000 user -COPY --from=builder-base /app/dist/*.tar.gz ./ # Install the package from the .tar.gz -RUN python -m pip install *.tar.gz --user +RUN python -m pip install /app/dist/*.tar.gz --user + -WORKDIR /app ENTRYPOINT ["python", "-m", "langflow", "run"] CMD ["--host", "0.0.0.0", "--port", "7860"] \ No newline at end of file diff --git a/build_and_push_base.Dockerfile b/build_and_push_base.Dockerfile index db6d0cf58..cbcdbceee 100644 --- a/build_and_push_base.Dockerfile +++ b/build_and_push_base.Dockerfile @@ -10,7 +10,7 @@ # PYTHON-BASE # Sets up all our shared environment variables ################################ -FROM python:3.10-slim as python-base +FROM python:3.12-slim as python-base # python ENV PYTHONUNBUFFERED=1 \ @@ -55,6 +55,8 @@ RUN apt-get update \ build-essential \ # npm npm \ + # gcc + gcc \ && apt-get clean \ && rm -rf /var/lib/apt/lists/* @@ -78,15 +80,11 @@ RUN cp -r src/frontend/build src/backend/base/langflow/frontend RUN rm -rf src/backend/base/dist RUN cd src/backend/base && $POETRY_HOME/bin/poetry build --format sdist -# Final stage for the application -FROM python-base as final - # Copy virtual environment and built .tar.gz from builder base RUN useradd -m -u 1000 user -COPY --from=builder-base /app/src/backend/base/dist/*.tar.gz ./ # Install the package from the .tar.gz -RUN pip install *.tar.gz --user +RUN python -m pip install /app/dist/*.tar.gz --user + -WORKDIR /app ENTRYPOINT ["python", "-m", "langflow", "run"] CMD ["--host", "0.0.0.0", "--port", "7860"] \ No newline at end of file