Skip to content

Instantly share code, notes, and snippets.

@gaborcsardi
Last active December 16, 2021 09:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gaborcsardi/8710fb2af93174c71b6ba1a9ce8803fa to your computer and use it in GitHub Desktop.
Save gaborcsardi/8710fb2af93174c71b6ba1a9ce8803fa to your computer and use it in GitHub Desktop.

Ubuntu 20.04 + rstudio/r-builds

docker build -t r-sodium-ubuntu:latest .

On an M1 mac you also need --platform linux/amd64.

Size is about 600MB:

❯ docker inspect r-sodium-ubuntu:latest | grep -i size
        "Size": 594108867,
        "VirtualSize": 594108867,

Alpine + r-minimal

docker build -t r-sodium-minimal:latest -f Dockerfile-minimal .

This does not currently work on M1 with --platform linux/amd64, possibly because of a docker or qemu bug.

Size is about 40MB:

❯ docker inspect r-sodium-minimal:latest | grep -i size
        "Size": 39340717,
        "VirtualSize": 39340717,
FROM ubuntu:20.04
ENV R_VERSION 4.1.2
RUN apt-get -y update && \
apt-get -y install wget gdebi-core && \
wget https://cdn.rstudio.com/r/ubuntu-2004/pkgs/r-${R_VERSION}_1_amd64.deb && \
gdebi --non-interactive r-${R_VERSION}_1_amd64.deb && \
rm r-${R_VERSION}_1_amd64.deb && \
apt-get -y autoremove gdebi-core && \
apt-get -y clean && \
rm -rf /var/lib/apt/lists/*
RUN ln -s /opt/R/${R_VERSION}/bin/R /usr/local/bin/R && \
ln -s /opt/R/${R_VERSION}/bin/Rscript /usr/local/bin/Rscript
RUN R -q -e 'install.packages("pak", repos = "https://r-lib.github.io/p/pak/devel")'
ENV PKG_SYSREQS true
RUN apt-get update && \
R -q -e 'pak::pkg_install("sodium")' && \
apt-get clean && \
rm -rf /var/lib/apt/lists/*
FROM rhub/r-minimal:4.1.2
RUN installr -a libsodium -d -t libsodium-dev sodium
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment