Skip to content

Commit 6dc9d09

Browse files
committed
new dockerfile, uses custom yaml file
1 parent 5200ee6 commit 6dc9d09

1 file changed

Lines changed: 15 additions & 7 deletions

File tree

Dockerfile

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,26 +2,34 @@
22
FROM rocker/r-ver:4.5.1
33

44
# 2. Install system dependencies
5-
# Note: Ubuntu 24.04 (Noble) uses libicu74, matching R 4.5 binaries
65
RUN apt-get update && apt-get install -y --no-install-recommends \
76
libxml2-dev libssl-dev libcurl4-openssl-dev \
87
libpng-dev libjpeg-dev zlib1g-dev libicu-dev \
98
libglpk-dev gfortran pandoc \
109
&& rm -rf /var/lib/apt/lists/*
1110

12-
WORKDIR /project
13-
14-
# 3. Use NOBLE (Ubuntu 24.04) binaries for R 4.5
11+
# 3. Setup Environment for Speed and Persistence
12+
# We move the library to /opt/renv so it isn't overwritten when you mount /project
13+
ENV RENV_PATHS_LIBRARY=/opt/renv/library
1514
ENV RENV_CONFIG_REPOS_OVERRIDE="https://packagemanager.posit.co/cran/__linux__/noble/latest"
1615
ENV RENV_DOWNLOAD_METHOD="libcurl"
1716

17+
WORKDIR /project
18+
1819
# 4. Setup and Restore
20+
# We restore specifically to the /opt path
1921
COPY renv.lock .Rprofile ./
2022
COPY renv/activate.R renv/activate.R
21-
RUN mkdir -p renv/library data
22-
RUN R -e "options(Ncpus = parallel::detectCores()); renv::restore()"
23+
RUN mkdir -p /opt/renv/library
24+
RUN R -e "options(Ncpus = parallel::detectCores()); renv::restore(library='/opt/renv/library')"
2325

26+
# 5. Copy Application Files
2427
COPY *.Rmd ./
2528
COPY _site.ym[l] ./
2629

27-
CMD ["R", "-e", "rmarkdown::render_site()"]
30+
# 6. Flexible Execution
31+
# This allows you to pass a custom yaml filename as an argument
32+
ENTRYPOINT ["sh", "-c", "R -e \"rmarkdown::render_site(config_file = '$1')\"", "--"]
33+
34+
# Default argument if you don't provide one
35+
CMD ["_site.yml"]

0 commit comments

Comments
 (0)