TimStats commited on
Commit
60882c9
·
verified ·
1 Parent(s): 539c8b9

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +43 -51
Dockerfile CHANGED
@@ -1,67 +1,59 @@
1
- FROM rocker/r-base:latest
2
 
3
  WORKDIR /code
4
 
5
- # Install system dependencies with specific focus on httpuv requirements
6
- RUN apt-get update && apt-get install -y \
7
- libcurl4-openssl-dev \
8
- libssl-dev \
9
- libxml2-dev \
10
- libcairo2-dev \
11
- libxt-dev \
12
- make \
13
- g++ \
14
- libudunits2-dev \
15
- zlib1g-dev \
16
- libbz2-dev \
17
- && rm -rf /var/lib/apt/lists/*
18
-
19
- # Install httpuv and its dependencies separately and one at a time
20
- RUN R -e 'install.packages("later", repos="https://cloud.r-project.org", dependencies=TRUE)'
21
- RUN R -e 'install.packages("promises", repos="https://cloud.r-project.org", dependencies=TRUE)'
22
- RUN R -e 'install.packages("httpuv", repos="https://cloud.r-project.org", dependencies=TRUE)'
23
- RUN R -e 'if(!require("httpuv")) stop("httpuv installation failed")'
24
-
25
- # Install shiny after httpuv is confirmed working
26
- RUN R -e 'install.packages("shiny", repos="https://cloud.r-project.org", dependencies=TRUE)'
27
- RUN R -e 'if(!require("shiny")) stop("shiny installation failed")'
28
-
29
- # Install basic packages
30
- RUN R -e 'install.packages(c("remotes", "curl", "httr", "dplyr", "ggplot2", "readr"), repos="https://cloud.r-project.org", dependencies=TRUE)'
31
-
32
- # Install additional packages
33
- RUN R -e 'install.packages(c("patchwork", "gridExtra", "gtable", "bslib", "jsonlite"), repos="https://cloud.r-project.org", dependencies=TRUE)'
34
-
35
- # Install magick and showtext
36
  RUN apt-get update && apt-get install -y \
37
  libmagick++-dev \
38
  imagemagick \
 
 
39
  libfontconfig1-dev \
40
  libfreetype6-dev \
41
  libharfbuzz-dev \
42
  libfribidi-dev \
43
- && rm -rf /var/lib/apt/lists/*
44
-
45
- RUN R -e 'install.packages("magick", repos="https://cloud.r-project.org", dependencies=TRUE)'
46
- RUN R -e 'install.packages("showtext", repos="https://cloud.r-project.org", dependencies=TRUE)'
47
-
48
- # Install fonts
49
- RUN apt-get update && apt-get install -y fonts-roboto && rm -rf /var/lib/apt/lists/*
50
-
51
- # Defer arrow installation to the end as it's complex
52
- RUN apt-get update && apt-get install -y \
53
  cmake \
54
- rapidjson-dev \
55
- libboost-all-dev \
56
- libjemalloc-dev \
57
- libzstd-dev \
58
- liblz4-dev \
59
- libprotobuf-dev \
60
- protobuf-compiler \
61
  && rm -rf /var/lib/apt/lists/*
62
 
63
- RUN R -e 'Sys.setenv(ARROW_WITH_ZLIB="ON"); Sys.setenv(LIBARROW_MINIMAL="false"); Sys.setenv(NOT_CRAN="true"); install.packages("arrow", repos="https://cloud.r-project.org", type="source")'
64
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
65
  COPY . .
66
 
 
 
 
 
67
  CMD ["R", "--quiet", "-e", "shiny::runApp(host='0.0.0.0', port=7860)"]
 
1
+ FROM rocker/shiny:latest
2
 
3
  WORKDIR /code
4
 
5
+ # Install system dependencies in a single layer
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
6
  RUN apt-get update && apt-get install -y \
7
  libmagick++-dev \
8
  imagemagick \
9
+ libcurl4-openssl-dev \
10
+ libssl-dev \
11
  libfontconfig1-dev \
12
  libfreetype6-dev \
13
  libharfbuzz-dev \
14
  libfribidi-dev \
15
+ libxml2-dev \
16
+ libcairo2-dev \
17
+ libxt-dev \
18
+ fonts-roboto \
 
 
 
 
 
 
19
  cmake \
 
 
 
 
 
 
 
20
  && rm -rf /var/lib/apt/lists/*
21
 
22
+ # Set CRAN mirror once
23
+ RUN echo 'options(repos = c(CRAN = "https://cloud.r-project.org"))' > ~/.Rprofile
24
+
25
+ # Install core R packages first (split into smaller groups)
26
+ RUN R -e 'install.packages(c("remotes", "curl", "httr", "jsonlite", "bslib"))'
27
+ RUN R -e 'install.packages(c("ggplot2", "dplyr", "grid", "gridExtra", "gtable"))'
28
+ RUN R -e 'install.packages(c("patchwork", "readr"))'
29
+
30
+ # Install magick separately
31
+ RUN R -e 'install.packages("magick")'
32
+
33
+ # Install showtext
34
+ RUN R -e 'install.packages("showtext")'
35
+
36
+ # Install arrow last with optimized settings
37
+ ENV ARROW_R_DEV=TRUE
38
+ ENV NOT_CRAN=TRUE
39
+ # Try binary first, fall back to minimal build
40
+ RUN R -e 'tryCatch(install.packages("arrow", INSTALL_opts = "--no-test-load"), \
41
+ error = function(e) { \
42
+ Sys.setenv(LIBARROW_MINIMAL="true"); \
43
+ Sys.setenv(ARROW_WITH_ZLIB="OFF"); \
44
+ Sys.setenv(ARROW_WITH_ZSTD="OFF"); \
45
+ Sys.setenv(ARROW_WITH_LZ4="OFF"); \
46
+ Sys.setenv(ARROW_WITH_SNAPPY="OFF"); \
47
+ Sys.setenv(ARROW_WITH_BROTLI="OFF"); \
48
+ Sys.setenv(ARROW_WITH_PARQUET="ON"); \
49
+ install.packages("arrow", INSTALL_opts = "--no-test-load") \
50
+ })'
51
+
52
+ # Copy app files
53
  COPY . .
54
 
55
+ # Expose port
56
+ EXPOSE 7860
57
+
58
+ # Run app
59
  CMD ["R", "--quiet", "-e", "shiny::runApp(host='0.0.0.0', port=7860)"]