Skip to content

Commit 6415eca

Browse files
committed
build now copies all files and allows for correct entrypoint
1 parent 8290819 commit 6415eca

1 file changed

Lines changed: 18 additions & 33 deletions

File tree

Dockerfile

Lines changed: 18 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -1,48 +1,33 @@
1-
# 1. Use R 4.5.1 (Matches Rocker's Ubuntu 24.04 based image)
1+
# 1. Use R 4.5.1
22
FROM rocker/r-ver:4.5.1
33

44
# 2. Install system dependencies
5-
# Added libharfbuzz-dev, libfribidi-dev, and libfreetype6-dev for 'ragg'
65
RUN apt-get update && apt-get install -y --no-install-recommends \
7-
libxml2-dev \
8-
libssl-dev \
9-
libcurl4-openssl-dev \
10-
libpng-dev \
11-
libjpeg-dev \
12-
libtiff-dev \
13-
libfreetype6-dev \
14-
libharfbuzz-dev \
15-
libfribidi-dev \
16-
libicu-dev \
17-
libglpk-dev \
18-
zlib1g-dev \
19-
gfortran \
20-
pandoc \
21-
pkg-config \
6+
libxml2-dev libssl-dev libcurl4-openssl-dev libpng-dev \
7+
libjpeg-dev libtiff-dev libfreetype6-dev libharfbuzz-dev \
8+
libfribidi-dev libicu-dev libglpk-dev zlib1g-dev \
9+
gfortran pandoc pkg-config \
2210
&& rm -rf /var/lib/apt/lists/*
2311

24-
# 3. Setup Environment for Speed and Persistence
12+
# 3. Setup Environment
13+
ENV R_LIBS_USER=/opt/renv/library
2514
ENV RENV_PATHS_LIBRARY=/opt/renv/library
26-
# Using the 'noble' (Ubuntu 24.04) binary repo for speed
27-
ENV RENV_CONFIG_REPOS_OVERRIDE="https://packagemanager.posit.co/cran/__linux__/noble/latest"
28-
ENV RENV_DOWNLOAD_METHOD="libcurl"
29-
15+
ENV R_PROFILE_USER=/dev/null
3016
WORKDIR /project
3117

32-
# 4. Setup and Restore
33-
# Copy only the lockfile first to maximize Docker layer caching
18+
# 4. Restore Packages (Cached Layer)
3419
COPY renv.lock .Rprofile ./
3520
COPY renv/activate.R renv/activate.R
36-
3721
RUN mkdir -p /opt/renv/library
38-
RUN R -e "options(Ncpus = parallel::detectCores()); renv::restore(library='/opt/renv/library')"
22+
RUN R -e "renv::restore(library='/opt/renv/library')"
3923

40-
# 5. Copy Application Files
41-
COPY *.Rmd ./
42-
COPY _site.ym[l] ./
24+
# 5. Copy ALL Application Files
25+
# This brings in 3PodR.R, chapters/, R/, and everything else
26+
COPY . .
4327

44-
# 6. Flexible Execution
45-
ENTRYPOINT ["sh", "-c", "R -e \"rmarkdown::render_site(config_file = '$1')\"", "--"]
28+
# 6. Execution Logic
29+
# We use a symlink so that whatever config file you pass at runtime
30+
# becomes the "configuration.yml" your R code expects.
31+
ENTRYPOINT ["sh", "-c", "ln -sf /project/$1 /project/configuration.yml && R --vanilla -e 'bookdown::render_book(\"index.Rmd\")'", "--"]
4632

47-
# Default argument
48-
CMD ["_site.yml"]
33+
CMD ["configuration.yml"]

0 commit comments

Comments
 (0)