update Dockerfile and supervisord configuration to use Python 3.11 slim-bookworm and uv

This commit is contained in:
LUIS NOVO 2025-03-11 21:05:33 -03:00
parent fe23e35670
commit a24970e514
3 changed files with 18 additions and 21 deletions

View file

@ -1,9 +1,13 @@
# Use an official Python runtime as a base image
FROM python:3.11.7-slim-bullseye
# Use Python 3.11 slim image as base
FROM python:3.11-slim-bookworm
# Install uv using the official method
COPY --from=ghcr.io/astral-sh/uv:latest /uv /uvx /bin/
# Install system dependencies required for building certain Python packages
RUN apt-get update && apt-get upgrade -y && apt-get install -y \
gcc \
gcc git \
libmagic-dev \
ffmpeg \
&& rm -rf /var/lib/apt/lists/*
@ -11,16 +15,11 @@ RUN apt-get update && apt-get upgrade -y && apt-get install -y \
# Set the working directory in the container to /app
WORKDIR /app
RUN pip install poetry --no-cache-dir
RUN poetry self add poetry-plugin-dotenv
RUN poetry config virtualenvs.create false
COPY pyproject.toml poetry.lock /app/
RUN poetry install --only main
COPY . /app
RUN uv sync
EXPOSE 8502
RUN mkdir -p /app/data
CMD ["poetry", "run", "streamlit", "run", "app_home.py"]
CMD ["uv", "run", "streamlit", "run", "app_home.py"]

View file

@ -1,5 +1,9 @@
# Use an official Python runtime as a base image
FROM python:3.11.7-slim-bullseye
# Use Python 3.11 slim image as base
FROM python:3.11-slim-bookworm
# Install uv using the official method
COPY --from=ghcr.io/astral-sh/uv:latest /uv /uvx /bin/
# Install system dependencies required for building certain Python packages
RUN apt-get update && apt-get upgrade -y && apt-get install -y \
@ -13,14 +17,8 @@ RUN curl --proto '=https' --tlsv1.2 -sSf https://install.surrealdb.com | sh
# Set the working directory in the container to /app
WORKDIR /app
COPY pyproject.toml poetry.lock /app/
RUN pip install poetry --no-cache-dir
RUN poetry self add poetry-plugin-dotenv
RUN poetry config virtualenvs.create false
RUN poetry install --only main
COPY . /app
RUN uv sync
# Create supervisor configuration directory
RUN mkdir -p /etc/supervisor/conf.d

View file

@ -13,7 +13,7 @@ stderr_logfile_maxbytes=0
autorestart=true
[program:streamlit]
command=poetry run streamlit run app_home.py
command=uv run streamlit run app_home.py
stdout_logfile=/dev/stdout
stdout_logfile_maxbytes=0
stderr_logfile=/dev/stderr