ecaragnano commited on
Commit
577bea4
Β·
verified Β·
1 Parent(s): 164dc8c

Upload Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +60 -0
Dockerfile ADDED
@@ -0,0 +1,60 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ FROM python:3.11-slim-bookworm
2
+
3
+ # ── 1. System packages + R ──────────────────────────────────────────
4
+ RUN apt-get update && apt-get install -y --no-install-recommends \
5
+ build-essential \
6
+ r-base \
7
+ libcurl4-openssl-dev \
8
+ libssl-dev \
9
+ libxml2-dev \
10
+ libfontconfig1-dev \
11
+ libfreetype6-dev \
12
+ libharfbuzz-dev \
13
+ libfribidi-dev \
14
+ libpng-dev \
15
+ libjpeg-dev \
16
+ libtiff5-dev \
17
+ && rm -rf /var/lib/apt/lists/*
18
+
19
+ # ── 2. R packages via Posit Package Manager (bookworm binaries) ──────
20
+ RUN Rscript -e "\
21
+ options(repos = c(CRAN = 'https://packagemanager.posit.co/cran/__linux__/bookworm/latest')); \
22
+ install.packages(c( \
23
+ 'vctrs', 'rlang', 'pillar', \
24
+ 'readr', 'dplyr', 'tidyr', 'lubridate', \
25
+ 'ggplot2', 'MASS', 'zoo', 'jsonlite', 'scales' \
26
+ ), Ncpus = 2)"
27
+
28
+ # ── 3. Install jupyter_client system-wide so IRkernel::installspec() can find it
29
+ RUN pip install --no-cache-dir jupyter_client
30
+
31
+ # ── 4. IRkernel β€” system-wide ────────────────────────────────────────
32
+ RUN Rscript -e "\
33
+ options(repos = c(CRAN = 'https://packagemanager.posit.co/cran/__linux__/bookworm/latest')); \
34
+ install.packages('IRkernel')" \
35
+ && Rscript -e "IRkernel::installspec(user = FALSE)"
36
+
37
+ # ── 5. Non-root user (HF Spaces requirement) ─────────────────────────
38
+ RUN useradd -m -u 1000 user
39
+ USER user
40
+
41
+ ENV HOME=/home/user \
42
+ PATH=/home/user/.local/bin:$PATH
43
+
44
+ WORKDIR /home/user/app
45
+
46
+ # ── 6. Python dependencies ───────────────────────────────────────────
47
+ COPY --chown=user requirements.txt .
48
+ RUN pip install --no-cache-dir --upgrade pip \
49
+ && pip install --no-cache-dir -r requirements.txt
50
+
51
+ # ── 7. App source ────────────────────────────────────────────────────
52
+ COPY --chown=user . .
53
+
54
+ # ── 8. Gradio networking ─────────────────────────────────────────────
55
+ ENV GRADIO_SERVER_NAME="0.0.0.0" \
56
+ GRADIO_SERVER_PORT=7860
57
+
58
+ EXPOSE 7860
59
+
60
+ CMD ["python", "app.py"]