Skip to content

Instantly share code, notes, and snippets.

@BerriJ
Created August 18, 2021 10:30
Show Gist options
  • Save BerriJ/3a793e167886d915aae4b93a1ba2eb54 to your computer and use it in GitHub Desktop.
Save BerriJ/3a793e167886d915aae4b93a1ba2eb54 to your computer and use it in GitHub Desktop.
Dockerfile vscDebugger Problem
FROM ubuntu:focal
SHELL ["/bin/bash", "-c"]
ENV R_VERSION=4.1.1 \
# See https://packagemanager.rstudio.com/client/#/repos/1/overview
R_REPOS=https://packagemanager.rstudio.com/all/__linux__/focal/4526215 \
DISPLAY=:0 \
TZ=Europe/Berlin
ARG DEBIAN_FRONTEND=noninteractive
# Ubuntu Setup
RUN apt-get update &&\
apt-get -y --no-install-recommends install \
software-properties-common \
git \
build-essential \
tar \
curl \
dirmngr \
gnupg-agent \
fontconfig \
pandoc \
perl \
python3-pip \
wget \
libcurl4-openssl-dev \
openssl \
libssl-dev \
libmagick++-dev \
libpoppler-cpp-dev \
netbase \
libxml2-dev \
gdb \
libgsl-dev \
libudunits2-dev \
libgdal-dev \
libharfbuzz-dev \
libfribidi-dev \
vim \
cargo \
locales &&\
locale-gen en_US.UTF-8
# Install R
RUN apt-key adv --keyserver keyserver.ubuntu.com --recv-keys \
E298A3A825C0D65DFD57CBB651716619E084DAB9 \
&& add-apt-repository 'deb https://cloud.r-project.org/bin/linux/ubuntu focal-cran40/' \
&& apt-get -y install --no-install-recommends r-base=${R_VERSION}* r-base-core=${R_VERSION}* \
r-recommended=${R_VERSION}* r-base-dev=${R_VERSION}*
# This does not work:
RUN Rscript -e "install.packages('devtools', repos= '$R_REPOS')"
RUN Rscript -e "remotes::install_github('ManuelHentschel/vscDebugger@v0.4.7', repos= '$R_REPOS')"
# This works:
# RUN Rscript -e "remotes::install_github('ManuelHentschel/vscDebugger@v0.4.5', repos= '$R_REPOS')"
# Set the default shell to zsh rather than bash
ENTRYPOINT [ "/bin/zsh" ]
@eitsupi
Copy link

eitsupi commented Aug 22, 2021

@BerriJ Thank you very much for your detailed explanation.
I also think that complex images with several different languages installed generally need to be built by yourself.

However, it seems that rocker/r-ver also includes scripts to install pip and tlmgr packages. (I don't know if it fits your use case)

https://github.com/rocker-org/rocker-versioned2/blob/30fca60a9241fc1e3abc8ec9f16d4639f4343f29/scripts/install_python.sh
https://github.com/rocker-org/rocker-versioned2/blob/326dfed8cc12218e1bc3c28926eb811127e50625/scripts/install_texlive.sh

For example, rocker/verse, which already run the install_texlive.sh, seems to be quite widely used when R is used with latex. (I don't use latex myself and I'm not familiar with it, so I apologize if I'm wrong.)

And last but also important: I tend to update my container only in times where I don't have very important projects / deadlines. So I'm in charge of when anything changes in the container (potentially breaking stuff).

FYI, as you may know, in general, if you specify the Digest of an image, the pulled image will always be the same, and on GitHub, you can set dependabot to detect Digest changes and automatically create a PR when a new image is pushed.

FROM rocker/r-ver:4.1.1@sha256:f060daf95622ba9b8271dc6067036f98ed92bcd876b56827e4c3260ca162585d

https://dependabot.com/blog/dependabot-now-supports-docker/

@BerriJ
Copy link
Author

BerriJ commented Aug 22, 2021

Thank you! In particular for the dependabot hint.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment