Spaces:
Sleeping
Sleeping
Create Dockerfile
Browse files- Dockerfile +35 -0
Dockerfile
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
FROM python:3.13-slim
|
| 2 |
+
|
| 3 |
+
# Environment
|
| 4 |
+
ENV PYTHONDONTWRITEBYTECODE=1 \
|
| 5 |
+
PYTHONUNBUFFERED=1 \
|
| 6 |
+
PIP_NO_CACHE_DIR=1 \
|
| 7 |
+
HF_HUB_DISABLE_TELEMETRY=1 \
|
| 8 |
+
EXOMAC_LOCAL_DIR=/app/ExoMACModel/ExoMAC-KKT \
|
| 9 |
+
HF_HOME=/home/user/.cache/huggingface \
|
| 10 |
+
PORT=7860
|
| 11 |
+
|
| 12 |
+
WORKDIR /app
|
| 13 |
+
|
| 14 |
+
# Install dependencies first for better layer caching
|
| 15 |
+
COPY requirements.txt ./
|
| 16 |
+
RUN pip install --upgrade pip \
|
| 17 |
+
&& pip install --no-cache-dir -r requirements.txt
|
| 18 |
+
|
| 19 |
+
# Copy only what the app needs (avoid notebooks/datasets/.venv)
|
| 20 |
+
COPY app.py ./app.py
|
| 21 |
+
COPY models ./models
|
| 22 |
+
COPY ExoMACModel ./ExoMACModel
|
| 23 |
+
|
| 24 |
+
# Create non-root user matching Spaces runtime and fix permissions
|
| 25 |
+
RUN useradd -m -u 1000 -s /bin/bash user \
|
| 26 |
+
&& mkdir -p /home/user/.cache/huggingface \
|
| 27 |
+
&& chown -R user:user /app /home/user
|
| 28 |
+
|
| 29 |
+
USER 1000:1000
|
| 30 |
+
|
| 31 |
+
# API port
|
| 32 |
+
EXPOSE 7860
|
| 33 |
+
|
| 34 |
+
# Start FastAPI with Uvicorn on the provided PORT (Spaces uses 7860)
|
| 35 |
+
CMD ["sh", "-c", "uvicorn app:app --host 0.0.0.0 --port ${PORT:-7860}"]
|