Add BuildRequirements to DESCRIPTION file (similar to r-hub's install script) to identify dependencies that can be removed after R package installation. gcc musl-dev g++ can be added to Dockerfile, maybe even gfortran linux-headers:
# Istall SystemRequirements for handler.R from DESCRIPTION
RUN R -q -e 'source("/usr/local/bin/install.R"); install$sysreqs()'
RUN echo requirements.txt
RUN apk update
RUN apk add --no-cache gcc musl-dev g++ gfortran linux-headers
RUN xargs -a requirements.txt apk add
# Install packages (incl. remotes) for handler.R from DESCRIPTION
RUN R -q -e 'remotes::install_deps()'
# Install VersionedPackages for handler.R from DESCRIPTION
RUN R -q -e 'source("/usr/local/bin/install.R"); install$versioned()'
# Clean up
RUN apk del gcc musl-dev g++ gfortran linux-headers
RUN rm -rf /var/cache/apk/*
RUN rm requirements.txt
Add BuildRequirements to DESCRIPTION file (similar to r-hub's install script) to identify dependencies that can be removed after R package installation.
gcc musl-dev g++
can be added to Dockerfile, maybe evengfortran linux-headers
: