softwareDevelopment commited on
Commit
b13d40f
·
verified ·
1 Parent(s): 4ec40f6

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +34 -68
Dockerfile CHANGED
@@ -1,83 +1,49 @@
1
- FROM rocker/shiny:latest
2
-
3
- # Set working directory inside container
4
- WORKDIR /code
5
 
6
  # Install system dependencies
7
  RUN apt-get update && apt-get install -y \
8
  libcurl4-openssl-dev \
9
  libssl-dev \
10
  libxml2-dev \
11
- libnlopt-dev \
12
- libicu-dev \
13
- libgdal-dev \
14
- libgeos-dev \
15
- libproj-dev \
16
- libv8-dev \
17
- libnode-dev \
18
- libglpk-dev \
19
- libglpk40 \
20
- && apt-get clean \
21
  && rm -rf /var/lib/apt/lists/*
22
 
23
- # Install pak and remotes first (needed for GitHub installs)
24
- RUN install2.r --error remotes pak
25
-
26
- # Install htmlwidgets and related dependencies
27
- RUN install2.r --error \
28
- htmltools \
29
- htmlwidgets \
30
- jsonlite \
31
- crosstalk \
32
- magrittr \
33
- promises \
34
- ellmer \
35
- shinychat \
36
- text2vec \
37
- Matrix \
38
- shinydashboard \\
39
-
40
-
41
-
42
 
43
- # Install main packages
44
- RUN install2.r --error \
45
- nloptr \
46
- lme4 \
47
- emmeans \
48
- readxl \
49
- plotly \
50
- shinyjs \
51
- shinyWidgets \
52
- DT \
53
- RColorBrewer \
54
- ggrepel \
55
- openxlsx \
56
- randomForest \
57
- caret \
58
- qtl \
59
- writexl \
60
- viridis \
61
- devtools \
62
- tidyverse \
63
- igraph \
64
- vcfR \
65
- poppr \
66
- reshape2
67
 
68
- # Install packages from GitHub using pak (modern replacement for devtools::install_github)
69
- RUN R -e "pak::pak('cran/qtlDesign')" \
70
- && R -e "pak::pak('jtlovell/qtlTools')"
71
 
72
- # Create www directory and health file
73
- RUN mkdir -p /code/www && echo "OK" > /code/www/health
 
 
 
 
 
 
 
 
 
 
74
 
75
- # Copy app code
76
- COPY app.R /code/
 
77
 
78
- # Expose the port Shiny will run on
79
- EXPOSE 7860
80
 
81
- # Run the app
82
- CMD ["R", "--quiet", "-e", "shiny::runApp('/code', host='0.0.0.0', port=7860)"]
83
 
 
 
1
+ FROM rocker/shiny:4.3.2
 
 
 
2
 
3
  # Install system dependencies
4
  RUN apt-get update && apt-get install -y \
5
  libcurl4-openssl-dev \
6
  libssl-dev \
7
  libxml2-dev \
8
+ libfontconfig1-dev \
9
+ libharfbuzz-dev \
10
+ libfribidi-dev \
11
+ libfreetype6-dev \
12
+ libpng-dev \
13
+ libtiff5-dev \
14
+ libjpeg-dev \
 
 
 
15
  && rm -rf /var/lib/apt/lists/*
16
 
17
+ # Install required R packages
18
+ RUN R -e "install.packages(c('shiny', 'htmltools'), repos='https://cran.rstudio.com/', dependencies=TRUE)"
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
19
 
20
+ # HuggingFace Spaces runs on port 7860
21
+ ENV PORT=7860
22
+ EXPOSE 7860
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
23
 
24
+ # Copy app files into the Shiny server directory
25
+ COPY app.R /srv/shiny-server/app/app.R
 
26
 
27
+ # Override Shiny Server config to use port 7860
28
+ RUN echo 'run_as shiny;\n\
29
+ \n\
30
+ server {\n\
31
+ listen 7860;\n\
32
+ \n\
33
+ location / {\n\
34
+ site_dir /srv/shiny-server/app;\n\
35
+ log_dir /var/log/shiny-server;\n\
36
+ directory_index on;\n\
37
+ }\n\
38
+ }' > /etc/shiny-server/shiny-server.conf
39
 
40
+ # Fix permissions
41
+ RUN chown -R shiny:shiny /srv/shiny-server/app \
42
+ && chmod -R 755 /srv/shiny-server/app
43
 
44
+ # HuggingFace requires the container to run as a non-root user (UID 1000)
45
+ RUN usermod -u 1000 shiny && groupmod -g 1000 shiny
46
 
47
+ USER shiny
 
48
 
49
+ CMD ["/usr/bin/shiny-server"]