Skip to content
Permalink
Browse files

Merge branch 'master' of https://github.molgen.mpg.de/loosolab/wilson…

  • Loading branch information
HendrikSchultheis committed Mar 21, 2019
2 parents abc62aa + 3b4f137 commit 8fec4e70331499f2e6452265a41ff8267ce4c1f8
Showing with 123 additions and 0 deletions.
  1. +82 −0 docker/1.5.4/Dockerfile
  2. +41 −0 docker/1.5.4/entrypoint.sh
@@ -0,0 +1,82 @@
# Pulls debian:latest from dockerhub
FROM debian

# Dockerfile questions go to
MAINTAINER C. Kuenne / MPI-BN / Bioinformatics / carsten.kuenne@mpi-bn.mpg.de

#Some basic packages, updates and cleanup
RUN apt-get -y update && apt-get -y upgrade && \
apt-get -y install \
r-base \
wget \
libnlopt-dev \
libssl-dev \
libxml2-dev \
libcurl4-openssl-dev \
git \
procps \
gdebi-core && \
apt-get clean

#Installs DEVTOOLS
RUN Rscript -e "install.packages(c('devtools'), repos='https://cran.rstudio.com/')"

#Installs BIOCONDUCTOR/BiocInstaller
RUN Rscript -e 'source("https://bioconductor.org/biocLite.R")'

#Install Shiny-Server
#RUN wget https://download3.rstudio.org/ubuntu-12.04/x86_64/shiny-server-1.5.6.875-amd64.deb && \
#gdebi -n shiny-server-1.5.6.875-amd64.deb && \
#RUN wget https://download3.rstudio.org/ubuntu-14.04/x86_64/shiny-server-1.5.7.907-amd64.deb && \
#gdebi -n shiny-server-1.5.7.907-amd64.deb && \
RUN wget https://download3.rstudio.org/ubuntu-14.04/x86_64/shiny-server-1.5.9.923-amd64.deb && \
gdebi -n shiny-server-1.5.9.923-amd64.deb && \
rm /srv/shiny-server/index.html && \
rm -rf /srv/shiny-server/sample-apps

#install shinythemes
RUN Rscript -e 'install.packages("shinythemes", repos="http://cran.wustl.edu/")'

#install shinyBS
RUN Rscript -e 'install.packages("shinyBS", repos="http://cran.wustl.edu/")'

#install old mvtnorm package (1.0-8), because the current 1.0-10 needs r 3.5 (current debian r is 3.3)
RUN Rscript -e 'devtools::install_version(repos="http://cran.wustl.edu/", package = "mvtnorm", version = "1.0-8")'

#Install WILSON
RUN Rscript -e 'devtools::install_github(repo = "loosolab/wilson", host="github.molgen.mpg.de/api/v3", auth_token = NULL, upgrade = "never")'

#Install stackdump
#RUN Rscript -e 'devtools::install_github(repo = "jcheng5/stackdump")'

#Install WILSON App
#RUN git clone -b stackdump https://github.molgen.mpg.de/loosolab/wilson-apps /srv/shiny-server/tmp && \
RUN git clone https://github.molgen.mpg.de/loosolab/wilson-apps /srv/shiny-server/tmp && \
cp -a /srv/shiny-server/tmp/wilson-basic/. /srv/shiny-server/ && \
rm -rf /srv/shiny-server/tmp

#Install webshot/phantomjs to permit download of interactive plots with plot.ly
RUN Rscript -e 'install.packages("webshot", repos="http://cran.wustl.edu")'
RUN Rscript -e 'webshot::install_phantomjs()'
RUN cp /root/bin/phantomjs /usr/local/bin

EXPOSE 3838

RUN rm -rf /srv/shiny-server/data && \
mkdir /srv/shiny-server/data

#check current directory for the presence of clarion input files (*.se, *.clarion) -> include in container
#add pointless additional copy of entrypoint.sh because otherwise the building will fail if no clarion files exist (yuck!)
ADD entrypoint.sh *.se *.clarion /srv/shiny-server/data/
RUN rm /srv/shiny-server/data/entrypoint.sh

ADD entrypoint.sh /usr/bin/entrypoint.sh
RUN chmod +x /usr/bin/entrypoint.sh

#switch shiny user uid to 1000 (previously docker user); set permissions
RUN usermod -u 1000 shiny && \
chown -R shiny:shiny /srv/shiny-server/ && \
mkdir -p /srv/shiny-server/logs && \
chmod ugo+wrX /srv/shiny-server/logs

CMD ["/usr/bin/entrypoint.sh"]
@@ -0,0 +1,41 @@
#!/bin/bash

#this script is run when the container is started
#optionally adds $CONTAINERKEY to shiny server url by modifying shiny-server.conf
#
#example:
#http://<IP>:<PORT>
#->
#http://<IP>:<PORT>/<CONTAINERKEY>
#
#to use this add the "-e" parameter when starting a container:
#docker run ... -e CONTAINERKEY=${container_key} ...
#example:
#docker run --name='sav1' -d -p 50000:3838 -v '/mnt/agnerds/docker/projects/sav1':'/srv/shiny-server/data' -e CONTAINERKEY=sav1 loosolab/wilson:1.2"
#-> http://<IP>:50000/sav1

conf="/etc/shiny-server/shiny-server.conf"

#create backup of original shiny-server.conf
if [[ ! -f "${conf}.old" ]]; then
cp ${conf} ${conf}.old
else
cp ${conf}.old ${conf}
fi

#add parameter(s) at top of .conf
param="preserve_logs true;"
sed -i "1i $param" ${conf}

param="sanitize_errors off;"
sed -i "1i $param" ${conf}

#if environment variable given -> add key to url
if [[ ! -z "$CONTAINERKEY" ]]; then
CONTAINERKEY=$(echo -e $CONTAINERKEY | sed 's/\//\\\//g') #to escape "/"
cat ${conf} | sed "s/location \//location \/$CONTAINERKEY/g" >${conf}.1
mv ${conf}.1 ${conf}
fi

#start shiny server
exec shiny-server 2>&1 >>/var/log/shiny-server.log

0 comments on commit 8fec4e7

Please sign in to comment.
You can’t perform that action at this time.