|
1 | 1 | # 1. Use R 4.5.1 |
2 | 2 | FROM rocker/r-ver:4.5.1 |
3 | 3 |
|
4 | | -# 2. Install system dependencies |
| 4 | +# 2. Install system dependencies (restoring cmake and adding nlopt) |
5 | 5 | RUN apt-get update && apt-get install -y --no-install-recommends \ |
6 | 6 | libxml2-dev libssl-dev libcurl4-openssl-dev libpng-dev \ |
7 | 7 | libjpeg-dev libtiff-dev libfreetype6-dev libharfbuzz-dev \ |
8 | 8 | libfribidi-dev libicu-dev libglpk-dev zlib1g-dev \ |
9 | 9 | gfortran pandoc pkg-config \ |
| 10 | + cmake libnlopt-dev \ |
10 | 11 | && rm -rf /var/lib/apt/lists/* |
11 | 12 |
|
12 | 13 | # 3. Setup Environment |
13 | 14 | ENV R_LIBS_USER=/opt/renv/library |
14 | 15 | ENV RENV_PATHS_LIBRARY=/opt/renv/library |
15 | | -# This prevents your local .Rprofile from causing loops during build |
16 | 16 | ENV R_PROFILE_USER=/dev/null |
| 17 | +# Force renv to use the Linux binaries for speed |
| 18 | +ENV RENV_CONFIG_REPOS_OVERRIDE="https://packagemanager.posit.co/cran/__linux__/noble/latest" |
| 19 | + |
17 | 20 | WORKDIR /project |
18 | 21 |
|
19 | 22 | # 4. Restore Packages (Cached Layer) |
20 | 23 | COPY renv.lock .Rprofile ./ |
21 | 24 | COPY renv/activate.R renv/activate.R |
22 | 25 |
|
23 | | -# Bootstrap: Install renv from binaries for speed |
| 26 | +# Bootstrap: Install renv from binaries |
24 | 27 | RUN R -e "options(repos = c(CRAN = 'https://packagemanager.posit.co/cran/__linux__/noble/latest')); install.packages('renv')" |
25 | 28 |
|
26 | 29 | RUN mkdir -p /opt/renv/library |
27 | | -# Now renv::restore will work |
| 30 | +# Now renv::restore will work with the binary override |
28 | 31 | RUN R -e "renv::restore(library='/opt/renv/library')" |
29 | 32 |
|
30 | 33 | # 5. Copy ALL Application Files |
31 | | -# This ensures 3PodR.R, chapters/, R/, style.css, etc. are included |
32 | 34 | COPY . . |
33 | 35 |
|
34 | 36 | # 6. Execution Logic |
35 | | -# We force the symlink and run render_book. |
36 | | -# Using index.Rmd ensures bookdown merges your chapters correctly. |
37 | 37 | ENTRYPOINT ["sh", "-c", "ln -sf /project/$1 /project/configuration.yml && R --vanilla -e 'bookdown::render_book(\"index.Rmd\")'", "--"] |
38 | 38 |
|
39 | 39 | CMD ["configuration.yml"] |
0 commit comments