Spaces:
Running
on
CPU Upgrade
Running
on
CPU Upgrade
File size: 987 Bytes
b91f2b7 e7abd9e b91f2b7 e7abd9e b91f2b7 e7abd9e b91f2b7 e7abd9e b91f2b7 e7abd9e b91f2b7 e7abd9e b91f2b7 e7abd9e b91f2b7 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 |
# Use a Python image with uv pre-installed
FROM ghcr.io/astral-sh/uv:python3.12-bookworm-slim
# Set the working directory
WORKDIR /app
# Enable bytecode compilation
ENV UV_COMPILE_BYTECODE=1
# Copy from the cache instead of linking since it's a mounted volume
ENV UV_LINK_MODE=copy
# Environment variables configuration for logs
ENV PYTHONUNBUFFERED=1
ENV LOG_LEVEL=INFO
# Install required system dependencies
RUN apt-get update && apt-get install -y \
build-essential \
&& rm -rf /var/lib/apt/lists/*
# Copy uv configuration files
COPY pyproject.toml uv.lock ./
# Install dependencies using uv
RUN uv sync --frozen --no-install-project --no-dev
# Place executables in the environment at the front of the path
ENV PATH="/app/.venv/bin:$PATH"
# Reset the entrypoint, don't invoke `uv`
ENTRYPOINT []
# In dev, mount volume directly
CMD ["uv" "run" "uvicorn", "app.asgi:app", "--host", "0.0.0.0", "--port", "7860", "--reload", "--log-level", "warning", "--no-access-log"]
|