diff --git a/Dockerfile b/Dockerfile index f903a3f..51207f5 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,6 +1,17 @@ FROM centos:7 -RUN yum -y update; yum clean all; yum -y install wget git ed libcurl-devel gcc-c++ pango-devel +ENV user_id 1000 +ENV user_name miracle + +RUN yum -y update && yum clean all && yum -y install \ + wget \ + git \ + ed \ + libcurl-devel \ + gcc-c++ \ + pango-devel + +RUN useradd -u $user_id $user_name WORKDIR /opt/ # Install R @@ -11,19 +22,33 @@ RUN sed -i "4s/.*/R_HOME_DIR=\/usr\/lib64\/RRO-3.2.2\/R-3.2.2\/lib64\/R/g" /usr/ # Install necessary R packages RUN R -e "install.packages(c('shiny', 'rmarkdown'), repos='https://cran.rstudio.com/')" + # Install Shiny Server -RUN wget https://download3.rstudio.org/centos5.9/x86_64/shiny-server-1.4.0.721-rh5-x86_64.rpm; \ - yum install -y --nogpgcheck shiny-server-1.4.0.721-rh5-x86_64.rpm; \ - rm -rf shiny-server-1.4.0.721-rh5-x86_64.rpm +RUN wget https://download3.rstudio.org/centos5.9/x86_64/shiny-server-1.4.0.756-rh5-x86_64.rpm; \ + yum install -y --nogpgcheck shiny-server-1.4.0.756-rh5-x86_64.rpm; \ + rm -rf shiny-server-1.4.0.756-rh5-x86_64.rpm + # Install Radiant RUN R -e "install.packages('radiant', repos='http://vnijs.github.io/radiant_miniCRAN/')" -RUN git clone --depth 1 https://github.com/warmdev/radiant-mod.git; \ - cp -r radiant-mod/inst/* /srv/shiny-server; cp -r radiant-mod/R /srv; \ - rm -rf radiant-mod; +RUN git clone --depth 1 https://github.com/warmdev/radiant-mod.git radiant; \ + cp -r radiant /srv/shiny-server; \ + cd /opt; rm -rf radiant; \ + cd /srv/shiny-server/radiant; rm -rf .Rbuildignore .git .gitingore .travis.yml build tests + # Add starting script +RUN sed -i -e 's/run_as shiny/run_as miracle/g' /etc/shiny-server/shiny-server.conf ADD shiny-server.sh /usr/bin/shiny-server.sh +USER root +RUN mkdir /miracle +RUN ln -s /miracle /srv/shiny-server/apps RUN chmod +x /usr/bin/shiny-server.sh +RUN chown $user_name:$user_name /usr/bin/shiny-server.sh +RUN mkdir -p /var/log/shiny-server +RUN touch /var/log/shiny-server.log +RUN chown $user_name:$user_name /var/log/shiny-server.log +RUN chown $user_name:$user_name /var/log/shiny-server +USER $user_name EXPOSE 3838 -CMD ["/usr/bin/shiny-server.sh"] \ No newline at end of file +CMD ["/usr/bin/shiny-server.sh"] diff --git a/README.md b/README.md index 5072ffc..137a3b0 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,7 @@ +## Dockerfile for Radiant + +Dockerfile for the `Radiant` business analytics tool developed by [Vincent Nijs](https://github.com/vnijs/radiant). + ## Dockerfile for `radiant-mod` Dockerfile for [radiant-mod](https://github.com/warmdev/radiant-mod) @@ -6,6 +10,8 @@ The Dockerfile is inspired by the `rocker/shiny` image and uses the `shiny-serve ### Usage +`Radiant` will be live at `http://localhost:3838/radiant/inst/base`. Replace `base` with `quant`, `analytics` or `marketing` for other `Radiant` apps. See https://github.com/vnijs/radiant for details. + ``` git clone https://github.com/warmdev/radiant-mod-docker.git cd radiant-mod-docker @@ -23,5 +29,5 @@ If you see `n_distinct` and `na.rm` related errors on the visualization page, th * OS: CentOS 7 * R: Revolution R Open 3.2.2 -* Shiny Server: 1.4.0.721 -* Radiant: 0.3.17 \ No newline at end of file +* Shiny Server: 1.4.0.756 +* Radiant: 0.3.17 diff --git a/shiny-server.sh b/shiny-server.sh index 3a7e200..b71d9c8 100644 --- a/shiny-server.sh +++ b/shiny-server.sh @@ -1,7 +1,4 @@ -#!/bin/sh +#!/usr/bin/env bash # Make sure the directory for individual app logs exists -mkdir -p /var/log/shiny-server -chown shiny.shiny /var/log/shiny-server - exec shiny-server >> /var/log/shiny-server.log 2>&1