Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Added files for container
  • Loading branch information
jenzopr committed Sep 5, 2019
1 parent 9219fb3 commit 89a0211
Show file tree
Hide file tree
Showing 4 changed files with 87 additions and 0 deletions.
3 changes: 3 additions & 0 deletions wilson-basic/.dockerignore
@@ -0,0 +1,3 @@
.dockerignore
Dockerfile
.DS_Store
51 changes: 51 additions & 0 deletions wilson-basic/Dockerfile
@@ -0,0 +1,51 @@
FROM rocker/shiny:3.6.1
LABEL maintainer="Jens Preussner <jens.preussner@mpi-bn.mpg.de>"
LABEL maintainer="Hendrik Schultheis <hendrik.schultheis@mpi-bn.mpg.de>"
LABEL maintainer="Carsten Kuenne <carsten.kuenne@mpi-bn.mpg.de>"
LABEL version="2.1.0"

#
# Configuration
#
ENV \
# Define the default location from which the app is served
WILSON_LOCATION=/ \
# Define the landing page for the app
WILSON_LANDING_PAGE=introduction

#
# Move app and data to container
#
COPY . /srv/shiny-server

#
# Installation procedure
#
RUN apt-get update && apt-get install -y \
libnlopt-dev \
libssl-dev \
libxml2-dev \
libcurl4-openssl-dev \
git \
procps \
python-pip && \
apt-get clean && \
# Install jinja2 templating engine
pip install j2cli && \
# Install R infrastructure
R -e "install.packages(c('BiocManager', 'webshot'), repos = c(CRAN = 'https://cloud.r-project.org/'))" && \
R -e "webshot::install_phantomjs()" && \
R -e "BiocManager::install(c('shinyBS', 'shinydashboard', 'shinythemes', 'htmltools', 'wilson'))" && \
cp /root/bin/phantomjs /usr/local/bin && \
# Move entrypoint, create log directory
mv /srv/shiny-server/entrypoint.sh / && \
mkdir /srv/shiny-server/logs && \
# Change ownerships
chmod -R ugo+wrX /var/log/shiny-server/ && \
chown -R shiny:shiny /srv/shiny-server/ && \
# Clean up existing sample apps
rm -rf /srv/shiny-server/[0-9][0-9]_* /srv/shiny-server/index.html /srv/shiny-server/sample-apps

# Start container
USER shiny
ENTRYPOINT ["/entrypoint.sh", "/usr/bin/shiny-server.sh"]
4 changes: 4 additions & 0 deletions wilson-basic/entrypoint.sh
@@ -0,0 +1,4 @@
#!/bin/bash -e
j2 /srv/shiny-server/shiny-server.conf.j2 > /srv/shiny-server/shiny-server.conf

exec "$@"
29 changes: 29 additions & 0 deletions wilson-basic/shiny-server.conf.j2
@@ -0,0 +1,29 @@
# Define the user we should use when spawning R Shiny processes
run_as shiny;

# Preserve logging, although the main process exits with status 0
preserve_logs true;

# Enable detailed error messages for users
sanitize_errors off;

# Define a top-level server which will listen on a port
server {
# Instruct this server to listen on port 3838
listen 3838;

# Define the location available at the base URL
location {{ "WILSON_LOCATION"|env("/") }} {

# Run this location in 'site_dir' mode, which hosts the entire directory
# tree at '/srv/shiny-server'
site_dir /srv/shiny-server;

# Define where we should put the log files for this location
log_dir /var/log/shiny-server;

# Should we list the contents of a (non-Shiny-App) directory when the user
# visits the corresponding URL?
directory_index on;
}
}

0 comments on commit 89a0211

Please sign in to comment.