diff --git a/wilson-basic/.dockerignore b/wilson-basic/.dockerignore new file mode 100644 index 0000000..f872fe2 --- /dev/null +++ b/wilson-basic/.dockerignore @@ -0,0 +1,3 @@ +.dockerignore +Dockerfile +.DS_Store \ No newline at end of file diff --git a/wilson-basic/Dockerfile b/wilson-basic/Dockerfile new file mode 100644 index 0000000..622a18f --- /dev/null +++ b/wilson-basic/Dockerfile @@ -0,0 +1,51 @@ +FROM rocker/shiny:3.6.1 +LABEL maintainer="Jens Preussner " +LABEL maintainer="Hendrik Schultheis " +LABEL maintainer="Carsten Kuenne " +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"] diff --git a/wilson-basic/entrypoint.sh b/wilson-basic/entrypoint.sh new file mode 100755 index 0000000..b77656d --- /dev/null +++ b/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 "$@" \ No newline at end of file diff --git a/wilson-basic/shiny-server.conf.j2 b/wilson-basic/shiny-server.conf.j2 new file mode 100644 index 0000000..f12c510 --- /dev/null +++ b/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; + } +}