Skip to content

Commit

Permalink
Update install_r.sh + Add cargo to Dockerfile
Browse files Browse the repository at this point in the history
  • Loading branch information
BerriJ committed Oct 2, 2024
1 parent aa0b130 commit dc7be38
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 12 deletions.
11 changes: 7 additions & 4 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ RUN echo "ttf-mscorefonts-installer msttcorefonts/accepted-mscorefonts-eula sele
ccache \
gfortran \
netbase \
cargo \
zip \
unzip \
xclip \
Expand Down Expand Up @@ -121,7 +122,7 @@ RUN apt-get update &&\
&& rm -rf /var/lib/apt/lists/*

# Set PATH for user installed python packages
ENV PATH="/home/vscode/.local/bin:${PATH}"
ENV PATH="/home/${USERNAME}/.local/bin:${PATH}"

# Install Latex
COPY install_scripts/install_latex.sh /tmp/install_latex.sh
Expand All @@ -135,17 +136,19 @@ RUN chmod +x /tmp/install_latex.sh &&\
&& tlmgr option -- srcfiles 0 \
&& tlmgr install \
$(grep -o '^[^#]*' /tmp/latex_packages.txt | tr '\n' ' ') \
&& chown --recursive $USERNAME:$USERNAME /usr/local/texlive
&& chown --recursive $USERNAME:$USERNAME /usr/local/texlive \
&& cargo install tex-fmt

# Set Latex Path
# Set Latex Paths
ENV PATH="/usr/local/texlive/bin/x86_64-linux:${PATH}"
ENV PATH="/home/${USERNAME}/.cargo/bin:${PATH}"

# Install R
ENV R_VERSION=4.4.1

# Set RSPM snapshot see:
# https://packagemanager.posit.co/client/#/repos/cran/setup?r_environment=other&snapshot=2024-10-01&distribution=ubuntu-22.04
ENV R_REPOS=https://packagemanager.posit.co/cran/__linux__/jammy/2024-10-01
ENV R_REPOS=https://packagemanager.posit.co/cran/__linux__/noble/2024-10-01

COPY install_scripts/install_r.sh /tmp/install_r.sh
COPY package_lists/r_packages.txt /tmp/r_packages.txt
Expand Down
19 changes: 11 additions & 8 deletions install_scripts/install_r.sh
Original file line number Diff line number Diff line change
@@ -1,9 +1,14 @@
#!/bin/bash

echo "deb http://cloud.r-project.org/bin/linux/ubuntu noble-cran40/" >> /etc/apt/sources.list
gpg --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys E298A3A825C0D65DFD57CBB651716619E084DAB9
gpg -a --export E298A3A825C0D65DFD57CBB651716619E084DAB9 | apt-key add -
apt-get update
apt update -qq
# install two helper packages we need
apt install -y --no-install-recommends software-properties-common dirmngr
# add the signing key (by Michael Rutter) for these repos
# To verify key, run gpg --show-keys /etc/apt/trusted.gpg.d/cran_ubuntu_key.asc
# Fingerprint: E298A3A825C0D65DFD57CBB651716619E084DAB9
wget -qO- https://cloud.r-project.org/bin/linux/ubuntu/marutter_pubkey.asc | tee -a /etc/apt/trusted.gpg.d/cran_ubuntu_key.asc
# add the R 4.X repo from CRAN
add-apt-repository "deb https://cloud.r-project.org/bin/linux/ubuntu noble-cran40/"

apt-get update

Expand All @@ -16,7 +21,6 @@ RUNDEPS="ca-certificates \
libxml2-dev \
vim-tiny \
wget \
dirmngr \
libmagick++-dev \
libpoppler-cpp-dev \
libudunits2-dev \
Expand All @@ -28,7 +32,6 @@ RUNDEPS="ca-certificates \
libfribidi-dev \
curl \
libgit2-dev \
pandoc-citeproc \
qpdf"

# Install R amd dependencies
Expand Down Expand Up @@ -59,7 +62,7 @@ echo 'options(HTTPUserAgent = sprintf("R/%s R (%s)", getRversion(), paste(getRv
Rscript -e "install.packages('docopt', repos= '$R_REPOS')"

# Install alternative r console
pip3 install -U --no-cache-dir radian
pip3 install --user --no-cache-dir --break-system-packages radian

# R packages on RSPM
install2.r --error --skipinstalled --ncpus 32 \
Expand All @@ -70,7 +73,7 @@ installGithub.r \
$(grep -o '^[^#]*' tmp/r_packages_github.txt | tr '\n' ' ')

# Miniconda for Refinitiv and resp. python dependenies
R -e "Refinitiv::install_eikon()"
# R -e "Refinitiv::install_eikon()"

chown --recursive $USERNAME:$USERNAME /usr/local/lib/R/site-library

Expand Down

0 comments on commit dc7be38

Please sign in to comment.