Spaces:
Sleeping
Sleeping
Create Dockerfile
Browse files- Dockerfile +51 -0
Dockerfile
ADDED
|
@@ -0,0 +1,51 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# ============================================================
|
| 2 |
+
# Dockerfile for HF Spaces (Docker SDK)
|
| 3 |
+
# - Runs a Gradio app (app.py)
|
| 4 |
+
# - Supports Python + R
|
| 5 |
+
# - Runs notebooks via papermill (Python + R kernel)
|
| 6 |
+
# ============================================================
|
| 7 |
+
|
| 8 |
+
FROM python:3.11-slim
|
| 9 |
+
|
| 10 |
+
# ---------- System deps ----------
|
| 11 |
+
# - build-essential, gfortran: needed for some R packages (glmnet)
|
| 12 |
+
# - r-base: R runtime
|
| 13 |
+
# - libcurl/ssl/xml2: common deps for R packages
|
| 14 |
+
# - default-jre: sometimes useful for some libs, safe to omit if you want
|
| 15 |
+
RUN apt-get update && apt-get install -y --no-install-recommends \
|
| 16 |
+
build-essential \
|
| 17 |
+
gfortran \
|
| 18 |
+
r-base \
|
| 19 |
+
r-base-dev \
|
| 20 |
+
libcurl4-openssl-dev \
|
| 21 |
+
libssl-dev \
|
| 22 |
+
libxml2-dev \
|
| 23 |
+
&& rm -rf /var/lib/apt/lists/*
|
| 24 |
+
|
| 25 |
+
# ---------- R packages ----------
|
| 26 |
+
# Install required R packages for your notebook + prediction:
|
| 27 |
+
# - jsonlite: read/write json
|
| 28 |
+
# - glmnet: lasso logistic regression
|
| 29 |
+
# - Matrix: sparse matrices
|
| 30 |
+
# - pROC: ROC/AUC
|
| 31 |
+
RUN R -e "install.packages(c('jsonlite','glmnet','Matrix','pROC'), repos='https://cloud.r-project.org')"
|
| 32 |
+
|
| 33 |
+
# ---------- IRkernel (so papermill can execute R notebooks) ----------
|
| 34 |
+
RUN R -e "install.packages('IRkernel', repos='https://cloud.r-project.org'); IRkernel::installspec(user = FALSE)"
|
| 35 |
+
|
| 36 |
+
# ---------- Python deps ----------
|
| 37 |
+
WORKDIR /app
|
| 38 |
+
COPY requirements.txt /app/requirements.txt
|
| 39 |
+
RUN pip install --no-cache-dir -r /app/requirements.txt
|
| 40 |
+
|
| 41 |
+
# papermill sometimes needs jupyter + ipykernel explicitly
|
| 42 |
+
RUN pip install --no-cache-dir jupyter ipykernel
|
| 43 |
+
|
| 44 |
+
# ---------- Copy project files ----------
|
| 45 |
+
COPY . /app
|
| 46 |
+
|
| 47 |
+
# HF uses port 7860
|
| 48 |
+
EXPOSE 7860
|
| 49 |
+
|
| 50 |
+
# ---------- Start Gradio app ----------
|
| 51 |
+
CMD ["python", "app.py"]
|