|
1 | | -# 1. Use r-ver for native Apple Silicon (ARM64) support |
| 1 | +# 1. Use r-ver (Works on Mac ARM64 and GitHub AMD64) |
2 | 2 | FROM rocker/r-ver:latest |
3 | 3 |
|
4 | | -# 2. Install system dependencies + Pandoc (Critical for RMarkdown) |
5 | | -RUN apt-get update && apt-get install -y \ |
| 4 | +# 2. Install system dependencies + Pandoc |
| 5 | +# Added image libraries (libpng, libjpeg) and string processing (libicu) |
| 6 | +RUN apt-get update && apt-get install -y --no-install-recommends \ |
6 | 7 | libxml2-dev \ |
7 | 8 | libssl-dev \ |
| 9 | + libcurl4-openssl-dev \ |
| 10 | + libpng-dev \ |
| 11 | + libjpeg-dev \ |
| 12 | + zlib1g-dev \ |
| 13 | + libicu-dev \ |
8 | 14 | pandoc \ |
9 | 15 | && rm -rf /var/lib/apt/lists/* |
10 | 16 |
|
11 | 17 | WORKDIR /project |
12 | 18 |
|
13 | | -# 3. Setup renv files |
| 19 | +# 3. FORCE BINARIES & PARALLELISM |
| 20 | +ENV RENV_CONFIG_REPOS_OVERRIDE="https://packagemanager.posit.co/cran/__linux__/jammy/latest" |
| 21 | +ENV RENV_DOWNLOAD_METHOD="libcurl" |
| 22 | +ENV RENV_PATHS_LIBRARY="renv/library" |
| 23 | + |
| 24 | +# 4. Setup renv files |
14 | 25 | COPY renv.lock .Rprofile ./ |
15 | 26 | COPY renv/activate.R renv/activate.R |
16 | | -RUN mkdir -p renv library data |
| 27 | +# Pre-create the library folder |
| 28 | +RUN mkdir -p renv/library data |
17 | 29 |
|
18 | | -# 4. SPEED BOOST: |
19 | | -# - Use 'jammy' binaries (pre-compiled for the container's Ubuntu base) |
20 | | -# - Use all CPU cores (Ncpus) to install 200+ packages in parallel |
21 | | -RUN R -e "options(repos = c(CRAN = 'https://packagemanager.posit.co/cran/__linux__/jammy/latest'), Ncpus = parallel::detectCores()); renv::restore()" |
| 30 | +# 5. Restore using all available CPU cores |
| 31 | +# This will now find the 'png.h' header it needs for the 'png' package |
| 32 | +RUN R -e "options(Ncpus = parallel::detectCores()); renv::restore()" |
22 | 33 |
|
23 | | -# 5. Copy your Rmd files and site configuration |
24 | | -# Use a wildcard for _site.yml so it doesn't crash if the file is missing |
| 34 | +# 6. Copy project assets |
25 | 35 | COPY *.Rmd ./ |
26 | 36 | COPY _site.ym[l] ./ |
27 | 37 |
|
28 | | -# 6. Render the site |
| 38 | +# 7. Render |
29 | 39 | CMD ["R", "-e", "rmarkdown::render_site()"] |
0 commit comments