File size: 743 Bytes
06b82bd
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
251763d
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
FROM python:3.11-slim-bookworm

# Set working directory
WORKDIR /app

# Install uv
RUN pip install --no-cache-dir uv

# Copy dependency files
COPY pyproject.toml uv.lock README.md ./

# Copy application code
COPY app ./app

# Install dependencies
# --frozen: use exact versions from uv.lock
# --no-dev: do not install development dependencies
RUN uv sync --frozen --no-dev

# Set environment variables
# Add the virtual environment to PATH
ENV PATH="/app/.venv/bin:$PATH"
ENV HOST=0.0.0.0

# Expose the port (Hugging Face typically uses 7860, local uses 8000)
ENV PORT=7860
EXPOSE $PORT

# Command to run the application (using shell form to expand variables)
CMD ["sh", "-c", "uvicorn app.main:app --loop asyncio --host 0.0.0.0 --port $PORT"]