docker: force python version to 3.12.3 (#2148)

* docker: force python version to 3.12.3

* also fixes pydantic

* remove ci build - too slow

* use lock file for deps

* use poetry.lock

* use poetry.lock
This commit is contained in:
Nicolò Boschi 2024-06-12 15:09:46 +02:00 committed by GitHub
commit 968ec28fbc
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 22 additions and 23 deletions

View file

@ -7,8 +7,9 @@
# Used to build deps + create our virtual environment
################################
# force platform to the current architecture to increase build speed time on multi-platform builds
FROM --platform=$BUILDPLATFORM python:3.12-slim as builder-base
# 1. use python:3.12.3-slim as the base image until https://github.com/pydantic/pydantic-core/issues/1292 gets resolved
# 2. do not add --platform=$BUILDPLATFORM because the pydantic binaries must be resolved for the final architecture
FROM python:3.12.3-slim as builder-base
ENV PYTHONDONTWRITEBYTECODE=1 \
\
@ -51,15 +52,27 @@ COPY pyproject.toml poetry.lock README.md ./
COPY src/ ./src
COPY scripts/ ./scripts
RUN python -m pip install requests --user && cd ./scripts && python update_dependencies.py
# 1. Install the dependencies using the current poetry.lock file to create reproducible builds
# 2. Do not install dev dependencies
# 3. Install all the extras to ensure all optionals are installed as well
# 4. --sync to ensure nothing else is in the environment
# 5. Build the wheel and install "langflow" package (mainly for version)
# Note: moving to build and installing the wheel will make the docker images not reproducible.
RUN $POETRY_HOME/bin/poetry lock --no-update \
# install current lock file with fixed dependencies versions \
# do not install dev dependencies \
&& $POETRY_HOME/bin/poetry install --without dev --sync -E deploy -E couchbase -E cassio \
&& $POETRY_HOME/bin/poetry build -f wheel \
&& $POETRY_HOME/bin/poetry run pip install dist/*.whl --force-reinstall
&& $POETRY_HOME/bin/poetry run pip install dist/*.whl
################################
# RUNTIME
# Setup user, utilities and copy the virtual environment only
################################
FROM python:3.12-slim as runtime
# 1. use python:3.12.3-slim as the base image until https://github.com/pydantic/pydantic-core/issues/1292 gets resolved
FROM python:3.12.3-slim as runtime
RUN apt-get -y update \
&& apt-get install --no-install-recommends -y \

View file

@ -10,7 +10,9 @@
# PYTHON-BASE
# Sets up all our shared environment variables
################################
FROM python:3.12-slim as python-base
# use python:3.12.3-slim as the base image until https://github.com/pydantic/pydantic-core/issues/1292 gets resolved
FROM python:3.12.3-slim as python-base
# python
ENV PYTHONUNBUFFERED=1 \

View file

@ -5,7 +5,7 @@
# BUILDER-BASE
################################
# force platform to the current architecture to increase build speed time on multi-platform builds
# 1. force platform to the current architecture to increase build speed time on multi-platform builds
FROM --platform=$BUILDPLATFORM node:lts-bookworm-slim as builder-base
COPY src/frontend /frontend