Spaces:
Sleeping
Sleeping
Update Dockerfile
Browse files- Dockerfile +12 -27
Dockerfile
CHANGED
|
@@ -1,17 +1,9 @@
|
|
| 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 |
-
# ----
|
| 11 |
-
#
|
| 12 |
-
# -
|
| 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 \
|
|
@@ -20,32 +12,25 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
|
|
| 20 |
libcurl4-openssl-dev \
|
| 21 |
libssl-dev \
|
| 22 |
libxml2-dev \
|
|
|
|
|
|
|
| 23 |
&& rm -rf /var/lib/apt/lists/*
|
| 24 |
|
| 25 |
-
# ----
|
| 26 |
-
#
|
| 27 |
-
|
| 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 |
-
# ----
|
| 34 |
-
RUN R -e "
|
| 35 |
|
| 36 |
-
# ----
|
| 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 |
-
# ----
|
| 45 |
COPY . /app
|
| 46 |
|
| 47 |
-
# HF uses port 7860
|
| 48 |
EXPOSE 7860
|
| 49 |
-
|
| 50 |
-
# ---------- Start Gradio app ----------
|
| 51 |
CMD ["python", "app.py"]
|
|
|
|
| 1 |
# ============================================================
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 2 |
FROM python:3.11-slim
|
| 3 |
|
| 4 |
+
# ---- System dependencies ----
|
| 5 |
+
# Key additions vs your previous Dockerfile:
|
| 6 |
+
# - libopenblas-dev, liblapack-dev: required to compile glmnet reliably
|
|
|
|
|
|
|
| 7 |
RUN apt-get update && apt-get install -y --no-install-recommends \
|
| 8 |
build-essential \
|
| 9 |
gfortran \
|
|
|
|
| 12 |
libcurl4-openssl-dev \
|
| 13 |
libssl-dev \
|
| 14 |
libxml2-dev \
|
| 15 |
+
libopenblas-dev \
|
| 16 |
+
liblapack-dev \
|
| 17 |
&& rm -rf /var/lib/apt/lists/*
|
| 18 |
|
| 19 |
+
# ---- R packages ----
|
| 20 |
+
# Set CRAN mirror explicitly + install packages
|
| 21 |
+
RUN R -e "options(repos=c(CRAN='https://cloud.r-project.org')); install.packages(c('jsonlite','Matrix','pROC','glmnet'), Ncpus=max(1, parallel::detectCores()-1))"
|
|
|
|
|
|
|
|
|
|
|
|
|
| 22 |
|
| 23 |
+
# ---- IRkernel (so papermill can run the R notebook kernel 'ir') ----
|
| 24 |
+
RUN R -e "options(repos=c(CRAN='https://cloud.r-project.org')); install.packages('IRkernel'); IRkernel::installspec(user = FALSE)"
|
| 25 |
|
| 26 |
+
# ---- Python deps ----
|
| 27 |
WORKDIR /app
|
| 28 |
COPY requirements.txt /app/requirements.txt
|
| 29 |
RUN pip install --no-cache-dir -r /app/requirements.txt
|
|
|
|
|
|
|
| 30 |
RUN pip install --no-cache-dir jupyter ipykernel
|
| 31 |
|
| 32 |
+
# ---- Copy project files ----
|
| 33 |
COPY . /app
|
| 34 |
|
|
|
|
| 35 |
EXPOSE 7860
|
|
|
|
|
|
|
| 36 |
CMD ["python", "app.py"]
|