FROM ghcr.io/astral-sh/uv:python3.11-bookworm-slim RUN apt-get update && apt-get install -y \ build-essential \ curl \ software-properties-common \ git \ && rm -rf /var/lib/apt/lists/* RUN useradd -m -u 1000 user USER user ENV HOME=/home/user \ PATH=/home/user/.local/bin:$PATH WORKDIR $HOME/app ENV UV_COMPILE_BYTECODE=1 # Install the project's dependencies using the lockfile and settings RUN --mount=type=cache,target=/root/.cache/uv \ --mount=type=bind,source=uv.lock,target=uv.lock \ --mount=type=bind,source=pyproject.toml,target=pyproject.toml \ uv sync --frozen --no-install-project --no-dev ADD . $HOME/app # Use uv sync to resolve and install dependencies RUN --mount=type=cache,target=/root/.cache/uv \ uv sync --frozen --no-dev # Place executables in the environment at the front of the path ENV PATH="$HOME/app/.venv/bin:$PATH" EXPOSE 8501 HEALTHCHECK CMD curl --fail http://localhost:8501/_stcore/health # Reset the entrypoint, don't invoke `uv` ENTRYPOINT [] ENV PYTHONPATH="$HOME/app/src:$PYTHONPATH" CMD ["uv", "run", "streamlit", "run", "src/app.py", "--server.port=8501", "--server.address=0.0.0.0", "--server.enableXsrfProtection=false"]