-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathDockerfile
More file actions
29 lines (21 loc) · 850 Bytes
/
Copy pathDockerfile
File metadata and controls
29 lines (21 loc) · 850 Bytes
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
FROM python:3.11-slim
WORKDIR /app
# Install system deps
RUN apt-get update && \
apt-get install -y --no-install-recommends curl && \
rm -rf /var/lib/apt/lists/*
# Copy requirements first for layer caching
COPY server/requirements.txt ./server/requirements.txt
RUN pip install --no-cache-dir -r server/requirements.txt
# Copy project
COPY . .
# Set PYTHONPATH and disable output buffering (critical for Docker log visibility)
ENV PYTHONPATH="/app"
ENV PYTHONUNBUFFERED=1
# Expose port
EXPOSE 7860
# Health check - generous timeouts for Hugging Face Spaces
HEALTHCHECK --interval=30s --timeout=10s --start-period=120s --retries=10 \
CMD curl -f http://localhost:7860/health || exit 1
# Run server (the app.py lifespan prints the full banner)
CMD ["python", "-m", "uvicorn", "server.app:app", "--host", "0.0.0.0", "--port", "7860"]