diff --git a/Dockerfile b/Dockerfile index be29a73..8df90f8 100644 --- a/Dockerfile +++ b/Dockerfile @@ -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"] diff --git a/Dockerfile.single b/Dockerfile.single index 1e09853..4c9af1f 100644 --- a/Dockerfile.single +++ b/Dockerfile.single @@ -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 diff --git a/supervisord.conf b/supervisord.conf index ca59e8b..57d2980 100644 --- a/supervisord.conf +++ b/supervisord.conf @@ -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