Upgrade Python base image to 3.12 and add gcc as dependency (#1908)

* 🔧 (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
This commit is contained in:
Gabriel Luiz Freitas Almeida 2024-05-16 00:27:07 -03:00 committed by GitHub
commit c4e60d71bc
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 15 additions and 15 deletions

View file

@ -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"]

View file

@ -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"]