VeenaLim commited on
Commit
180f41c
·
verified ·
1 Parent(s): 985df33

Upload Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +39 -0
Dockerfile ADDED
@@ -0,0 +1,39 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Use rocker/r-ver as base image with R pre-installed
2
+ FROM rocker/r-ver:4.3.2
3
+
4
+ # Install system dependencies required for R packages
5
+ RUN apt-get update && apt-get install -y --no-install-recommends \
6
+ libcurl4-openssl-dev \
7
+ libssl-dev \
8
+ libxml2-dev \
9
+ libsodium-dev \
10
+ libgit2-dev \
11
+ && rm -rf /var/lib/apt/lists/*
12
+
13
+ # Install R packages with explicit error checking
14
+ RUN R -e "install.packages('plumber', repos='https://cloud.r-project.org/')" && \
15
+ R -e "if (!require('plumber')) quit(status=1)"
16
+
17
+ RUN R -e "install.packages(c('readr', 'assertthat', 'jsonlite', 'remotes'), repos='https://cloud.r-project.org/')"
18
+
19
+ # Install dampack from GitHub
20
+ RUN R -e "remotes::install_github('DARTH-git/dampack', upgrade='never')" && \
21
+ R -e "if (!require('dampack')) quit(status=1)"
22
+
23
+ # Verify all packages are installed
24
+ RUN R -e "stopifnot(require('plumber'), require('readr'), require('assertthat'), require('jsonlite'), require('dampack'))"
25
+
26
+ # Create app directory structure
27
+ WORKDIR /app
28
+ RUN mkdir -p /app/api /app/model
29
+
30
+ # Copy all files
31
+ COPY plumber_hf.R /app/api/plumber.R
32
+ COPY darth_funcs.R /app/model/darth_funcs.R
33
+ COPY parameter_distributions.csv /app/parameter_distributions.csv
34
+
35
+ # Expose port 7860 (Hugging Face Spaces default)
36
+ EXPOSE 7860
37
+
38
+ # Run the Plumber API
39
+ CMD ["R", "-e", "library(plumber); pr <- plumb('/app/api/plumber.R'); pr$run(host='0.0.0.0', port=7860)"]