Optimize build: remove heavy deps (torch_scatter/transformers/biopython) — ETA <5min [2026-03-27 14:29 UTC]
Browse files- Dockerfile +6 -10
- requirements.txt +0 -6
Dockerfile
CHANGED
|
@@ -1,8 +1,8 @@
|
|
| 1 |
FROM python:3.11-slim
|
| 2 |
|
| 3 |
-
# System deps
|
| 4 |
RUN apt-get update && apt-get install -y --no-install-recommends \
|
| 5 |
-
|
| 6 |
rm -rf /var/lib/apt/lists/*
|
| 7 |
|
| 8 |
# Add a non-root user (Hugging Face Spaces runs as 1000)
|
|
@@ -10,13 +10,10 @@ RUN useradd -m -u 1000 appuser
|
|
| 10 |
|
| 11 |
WORKDIR /app
|
| 12 |
|
| 13 |
-
#
|
| 14 |
-
RUN pip install --no-cache-dir torch==2.6.0
|
| 15 |
|
| 16 |
-
#
|
| 17 |
-
RUN pip install --no-cache-dir torch_scatter torch_sparse -f https://data.pyg.org/whl/torch-2.6.0+cpu.html
|
| 18 |
-
|
| 19 |
-
# Step 3: Other Python deps
|
| 20 |
COPY requirements.txt .
|
| 21 |
RUN pip install --no-cache-dir -r requirements.txt
|
| 22 |
|
|
@@ -27,12 +24,11 @@ COPY --chown=appuser:appuser . .
|
|
| 27 |
ENV PYTHONPATH=/app:$PYTHONPATH \
|
| 28 |
HOME=/home/appuser
|
| 29 |
|
| 30 |
-
# Streamlit config
|
| 31 |
RUN mkdir -p /home/appuser/.streamlit && \
|
| 32 |
printf '[server]\nheadless = true\nport = 7860\nenableCORS = false\nenableXsrfProtection = false\n' > /home/appuser/.streamlit/config.toml && \
|
| 33 |
chown -R appuser:appuser /home/appuser/.streamlit /app
|
| 34 |
|
| 35 |
-
# Switch to the non-root user
|
| 36 |
USER appuser
|
| 37 |
|
| 38 |
EXPOSE 7860
|
|
|
|
| 1 |
FROM python:3.11-slim
|
| 2 |
|
| 3 |
+
# System deps
|
| 4 |
RUN apt-get update && apt-get install -y --no-install-recommends \
|
| 5 |
+
curl && \
|
| 6 |
rm -rf /var/lib/apt/lists/*
|
| 7 |
|
| 8 |
# Add a non-root user (Hugging Face Spaces runs as 1000)
|
|
|
|
| 10 |
|
| 11 |
WORKDIR /app
|
| 12 |
|
| 13 |
+
# Install torch CPU-only (slim, no CUDA)
|
| 14 |
+
RUN pip install --no-cache-dir torch==2.6.0+cpu --index-url https://download.pytorch.org/whl/cpu
|
| 15 |
|
| 16 |
+
# Install other Python deps
|
|
|
|
|
|
|
|
|
|
| 17 |
COPY requirements.txt .
|
| 18 |
RUN pip install --no-cache-dir -r requirements.txt
|
| 19 |
|
|
|
|
| 24 |
ENV PYTHONPATH=/app:$PYTHONPATH \
|
| 25 |
HOME=/home/appuser
|
| 26 |
|
| 27 |
+
# Streamlit config
|
| 28 |
RUN mkdir -p /home/appuser/.streamlit && \
|
| 29 |
printf '[server]\nheadless = true\nport = 7860\nenableCORS = false\nenableXsrfProtection = false\n' > /home/appuser/.streamlit/config.toml && \
|
| 30 |
chown -R appuser:appuser /home/appuser/.streamlit /app
|
| 31 |
|
|
|
|
| 32 |
USER appuser
|
| 33 |
|
| 34 |
EXPOSE 7860
|
requirements.txt
CHANGED
|
@@ -1,17 +1,11 @@
|
|
| 1 |
# PETIMOT Explorer — HuggingFace Spaces
|
| 2 |
-
# Note: torch, torch_scatter, torch_sparse installed separately in Dockerfile
|
| 3 |
streamlit>=1.30.0
|
| 4 |
stmol>=0.0.9
|
| 5 |
py3Dmol>=2.0.0
|
| 6 |
plotly>=5.18.0
|
| 7 |
pandas>=2.0.0
|
| 8 |
numpy>=1.24.0
|
| 9 |
-
torch_geometric>=2.0.0
|
| 10 |
-
transformers>=4.30.0
|
| 11 |
-
sentencepiece>=0.1.99
|
| 12 |
scipy>=1.10.0
|
| 13 |
-
biopython>=1.80
|
| 14 |
requests>=2.28.0
|
| 15 |
tqdm>=4.65.0
|
| 16 |
-
typer>=0.9.0
|
| 17 |
huggingface_hub>=0.20.0
|
|
|
|
| 1 |
# PETIMOT Explorer — HuggingFace Spaces
|
|
|
|
| 2 |
streamlit>=1.30.0
|
| 3 |
stmol>=0.0.9
|
| 4 |
py3Dmol>=2.0.0
|
| 5 |
plotly>=5.18.0
|
| 6 |
pandas>=2.0.0
|
| 7 |
numpy>=1.24.0
|
|
|
|
|
|
|
|
|
|
| 8 |
scipy>=1.10.0
|
|
|
|
| 9 |
requests>=2.28.0
|
| 10 |
tqdm>=4.65.0
|
|
|
|
| 11 |
huggingface_hub>=0.20.0
|