Skip to content

Instantly share code, notes, and snippets.

@Stfort52
Last active June 22, 2023 01:26
Show Gist options
  • Save Stfort52/9d7c4792941da40bc5be4e5572c892d5 to your computer and use it in GitHub Desktop.
Save Stfort52/9d7c4792941da40bc5be4e5572c892d5 to your computer and use it in GitHub Desktop.
My R(Cellchat) environment

Cellchat R environment

build

docker-compose up --build

contains

  • Cellchat
  • xterm for plotting
  • pandoc for Rmarkdowns
version: '3'
services:
r-housing:
build: .
cap_add:
- SYS_PTRACE #but i want gdb
security_opt:
- seccomp:unconfined
tty: true
stdin_open: true
ports:
- "1337:1337"
hostname: envi-r-on
FROM ubuntu:latest
RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -qy \
openssh-server \
vim \
python3 \
python3-pip \
python-is-python3 \
gcc \
gdb \
lrzsz \
xterm \
software-properties-common \
dirmngr \
htop \
sudo \
libxml2-dev \
libssl-dev \
libcurl4-openssl-dev \
libfontconfig1-dev \
libcairo2-dev \
libxt-dev \
git \
pandoc \
texlive-latex-base \
texlive-fonts-recommended \
texlive-fonts-extra \
texlive-latex-extra \
libharfbuzz-dev \
libfribidi-dev \
libfreetype6-dev \
libpng-dev \
libtiff5-dev \
libjpeg-dev
#install R & radian for quality life
RUN apt-key adv --keyserver keyserver.ubuntu.com --recv-keys E298A3A825C0D65DFD57CBB651716619E084DAB9
RUN add-apt-repository "deb https://cloud.r-project.org/bin/linux/ubuntu $(lsb_release -cs)-cran40/"
RUN apt-get install -qy r-base
RUN python -m pip install radian umap-learn
#R littler for more efficient scripting
RUN R -e "install.packages('littler')"
RUN ln -s /usr/local/lib/R/site-library/littler/bin/r /usr/bin
#install tidyverse, Cellchat & its dependencies
RUN r -e "install.packages('tidyverse')"
RUN r -e "install.packages('shiny')"
RUN r -e "install.packages('BiocManager')"
RUN r -e "BiocManager::install('Biobase')"
RUN r -e "BiocManager::install('ComplexHeatmap')"
RUN r -e "install.packages('devtools')"
RUN r -e "install.packages('httpgd')"
RUN r -e "devtools::install_github('sqjin/CellChat')"
RUN r -e "install.packages('Seurat')"
#global setup script
COPY setup.sh /root/setup.sh
CMD ["/bin/sh", "/root/setup.sh"]
#!/bin/sh
echo "[\033[1;32m+\033[0m] adding user"
echo "[edit here to add user]"; exit || echo "[\033[1;33m!\033[0m] failed to add user"
echo "[\033[1;32m+\033[0m] setting user password"
echo "[edit here to change password]"; exit || echo "[\033[1;33m!\033[0m] failed to set user password"
# Set SSHD option and start SSH service
echo "[\033[1;32m+\033[0m] starting sshd"
#sed -ri 's/^#?PermitRootLogin\s+.*/PermitRootLogin yes/' /etc/ssh/sshd_config
sed -ri 's/^#*?Port\s+.*/Port 1337/' /etc/ssh/sshd_config
sed -ri 's/^#?X11UseLocalhost\s+.*/X11UseLocalhost no/' /etc/ssh/sshd_config
service ssh start
echo "[\033[1;32m+\033[0m] Ready"
exec bash
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment