我尝试使用 Apptainer 构建一个 docker 容器。我有一长串要安装特定版本的 R 包。我需要直接从 CRAN/BioConductor 安装它,而不是从...
我尝试使用 Apptainer 构建一个 docker 容器。我有一长串要安装特定版本的 R 包。我需要直接从 CRAN/BioConductor 安装它,而不是从 conda 安装。现在,对于我尝试安装的每个包,我可能会因为缺少库而遇到障碍,然后不得不返回并使用 apt install 添加它。这成为一个迭代过程,需要很长时间。有没有一种交互式的方式来构建容器。我尝试使用 sandbox 和 fakeroot,但在安装系统库时它没有获得完整的写入功能。我还可以集成什么其他解决方案?
Bootstrap: docker
From: ubuntu:22.04
%labels
Author author_name
version v0.1
%post
export DEBIAN_FRONTEND=noninteractive
# Update system and install requirements
apt-get -qq update
apt -y install build-essential gfortran curl cmake pkg-config zip unzip \
libglib2.0-0 libpango-1.0-0 libpangocairo-1.0-0 libpaper-utils \
libtcl8.6 libtk8.6 libxt6 lmod
apt -y install libbz2-dev libicu-dev liblzma-dev libopenblas-dev libpq-dev \
libpcre2-dev zlib1g-dev libssl-dev libudunits2-dev libncurses-dev libcairo2-dev \
libsodium-dev libmariadb-dev libcurl4-openssl-dev libssh2-1-dev libxml2-dev \
libfreetype6-dev libpng-dev libtiff5-dev libjpeg-dev libfontconfig1-dev \
libharfbuzz-dev libfribidi-dev liblapack-dev libgit2-dev libmagick++-dev
curl -o /tmp/libicu60_60.2-3ubuntu3.2_amd64.deb http://security.ubuntu.com/ubuntu/pool/main/i/icu/libicu60_60.2-3ubuntu3.2_amd64.deb
dpkg -i /tmp/libicu60_60.2-3ubuntu3.2_amd64.deb
# Install R with all recommended
export R_VERSION=4.2.2
curl -o /tmp/r-${R_VERSION}_1_amd64.deb https://cdn.rstudio.com/r/ubuntu-2204/pkgs/r-${R_VERSION}_1_amd64.deb
dpkg -i /tmp/r-${R_VERSION}_1_amd64.deb
ln -s /opt/R/${R_VERSION}/bin/R /usr/local/bin/R
ln -s /opt/R/${R_VERSION}/bin/Rscript /usr/local/bin/Rscript
# Install the R packages
R -e 'install.packages("remotes", dependencies = TRUE, repos = c("https://cloud.r-project.org/", "http://rforge.net/"))'
R -e 'remotes::install_version(package = "BiocManager", version = "1.30.22", dependencies = TRUE, repos = c("https://cloud.r-project.org/", "http://rforge.net/"), upgrade = "never")'
R -e 'remotes::install_version(package = "dplyr", version = "1.1.4", dependencies = TRUE, repos = c("https://cloud.r-project.org/", "http://rforge.net/"), upgrade = "never")'
R -e 'remotes::install_version(package = "ggplot2", version = "3.5.1", dependencies = TRUE, repos = c("https://cloud.r-project.org/", "http://rforge.net/"), upgrade = "never")' ##### downgraded to 3.4.3
R -e 'remotes::install_version(package = "ggpubr", version = "0.6.0", dependencies = TRUE, repos = c("https://cloud.r-project.org/", "http://rforge.net/"), upgrade = "never")'