Skip to content

Commit

Permalink
Adds a shiny-base image for testing, updates shiny-server to publish (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
Bosse Nyström committed Nov 27, 2021
1 parent f2d4dfe commit 6d02cd2
Show file tree
Hide file tree
Showing 9 changed files with 150 additions and 7 deletions.
7 changes: 6 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,13 @@
.RData
.Ruserdata

shiny-base
shiny-server
Renviron
shiny-docker/shinyapps

*.html
!shiny/shinyapps/index.html
!shiny-index.html
shiny/shinyapps/*

# config files from another repo in config
Expand Down
27 changes: 23 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,12 +1,31 @@

ORGANISATION ?= verifa

INDEX_FILE := shiny-index.html
CONFIG_FILES := $(wildcard config/*.csv)
SHINY_FILES := shiny-tempo.Rmd $(wildcard *.R)

default: tempo.html
TEMPO_RENVIRON ?= $(HOME)/.Renviron

.PHONY: shiny-server
shiny-server:
cd $@ && docker build -t $(ORGANISATION)/$@ .
$(info $(SHINY_FILES))
$(exit)

default: shiny-server

shiny-base: shiny-docker/Dockerbase shiny-docker/install_packages.R Makefile
cd shiny-docker && docker build -f Dockerbase -t $(ORGANISATION)/$@ .
touch $@

shiny-server: shiny-base shiny-docker/Dockerfile Makefile $(SHINY_FILES) $(INDEX_FILE) $(CONFIG_FILES)
cp $(TEMPO_RENVIRON) shiny-docker/Renviron
mkdir -p shiny-docker/shinyapps
cp $(INDEX_FILE) shiny-docker/shinyapps/index.html
mkdir -p shiny-docker/shinyapps/shiny
cp $(SHINY_FILES) shiny-docker/shinyapps/shiny/.
mkdir -p shiny-docker/shinyapps/shiny/config
cp $(CONFIG_FILES) shiny-docker/shinyapps/shiny/config/.
cd shiny-docker && docker build --build-arg TEMPO_RENVIRON=Renviron --no-cache -t $(ORGANISATION)/$@ .
touch $@

.PHONY: rbase-metrics
rbase-metrics:
Expand Down
File renamed without changes.
9 changes: 9 additions & 0 deletions shiny-docker/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# base image
FROM verifa/shiny-base:latest

ARG TEMPO_RENVIRON
COPY ${TEMPO_RENVIRON} /home/shiny/.Renviron

COPY shinyapps /srv/shiny-server/.

#RUN
File renamed without changes.
File renamed without changes.
File renamed without changes.
7 changes: 5 additions & 2 deletions shiny/shiny.sh → shiny-test/shiny.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
pushd $(dirname ${0})
TEMPO_DOCS="tempo.html"
SHINY_DOCS="shiny-tempo.Rmd r-helpers.R data-helpers.R ggplot-helpers.R arbetsdag.R"
SHINY_INDEX="shiny-index.html"

if [ ! -f "../tempo.html" ]; then
pushd ..
Expand All @@ -11,7 +12,7 @@ if [ ! -f "../tempo.html" ]; then
fi

pushd ..
make shiny-server
make shiny-base
popd

for doc in ${TEMPO_DOCS}; do
Expand All @@ -23,6 +24,8 @@ for doc in ${SHINY_DOCS}; do
cp ../${doc} shinyapps/shiny/.
done

cp ../${SHINY_INDEX} shinyapps/index.html

if [ -d ../config ]; then
mkdir -p shinyapps/shiny/config
cp ../config/* shinyapps/shiny/config/.
Expand All @@ -32,6 +35,6 @@ docker run --rm -p 3838:3838 \
-v ${PWD}/shinyapps/:/srv/shiny-server/ \
-v ${HOME}/.Renviron:/home/shiny/.Renviron \
-u shiny \
verifa/shiny-server
verifa/shiny-base

popd
107 changes: 107 additions & 0 deletions shiny-test/shinyapps/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,107 @@
<!DOCTYPE html>
<!-- saved from url=(0022)http://localhost:3838/ -->
<html lang="en-US" xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Welcome to Shiny Server!</title>
<style type="text/css">
body, html {
font-family: Helvetica, Arial, sans-serif;
background-color: #F5F5F5;
color: #114;
margin: 0;
padding: 0;
}
a {
text-decoration: none;
}
a:hover {
text-decoration: underline;
}
#titleBar {
height: 80px;
background-color: #3475b4;
overflow: hidden;
border-bottom: 1px solid #3475b3;
-moz-box-shadow: 0px 0px 10px 3px #BBC;
-webkit-box-shadow: 0px 0px 10px 3px #BBC;
box-shadow: 0px 0px 10px 3px #BBC;
}
#titleBar #container {
margin-top: 14px;
}
#titleBar h1 {
margin: 0 auto .5em auto;
padding: .2em;
color: #EEE;
text-align: center;
}
#intro {
background-color: #DDD;
margin: 1em 1em 0 1em;
padding: .75em;
text-align: center;
border: 1px solid #CCC;
font-size: 18px;
}
#intro p {
margin: .3em 0 .3em 0;
}
#outer-content {
max-width: 910px;
margin-left: auto;
margin-right: auto;
}
#content {
margin: 1em auto 1em auto;
float: left;
}
#main{
margin-right: 350px;
float: left;
line-height: 24px;
}

#shiny{
float: left;
width: 305px;
margin-left: -330px;
padding-left: 20px;
border-left: 1px solid #AAA;
}
#shiny iframe {
margin-top: 30px;
}
.caption{
font-size: 13px;
}
code {
background-color: #E5E5E5;
border: 1px solid #AAA;
-webkit-border-radius: 3px;
-khtml-border-radius: 3px;
-moz-border-radius: 3px;
border-radius: 3px;
padding: 0 .5em 0 .5em;
}
</style>
<script data-dapp-detection="">!function(){let e=!1;function n(){if(!e){const n=document.createElement("meta");n.name="dapp-detected",document.head.appendChild(n),e=!0}}if(window.hasOwnProperty("ethereum")){if(window.__disableDappDetectionInsertion=!0,void 0===window.ethereum)return;n()}else{var t=window.ethereum;Object.defineProperty(window,"ethereum",{configurable:!0,enumerable:!1,set:function(e){window.__disableDappDetectionInsertion||n(),t=e},get:function(){if(!window.__disableDappDetectionInsertion){const e=arguments.callee;e&&e.caller&&e.caller.toString&&-1!==e.caller.toString().indexOf("getOwnPropertyNames")||n()}return t}})}}();</script></head>
<body>
<div id="titleBar">
<div id="container">
<h1>Welcome to Verifa Shiny Server!</h1>
</div>
</div>
<div id="outer-content">
<div id="content">
<div id="main">

<h2>Tempo Reports</h2>
<h2><a href="shiny/shiny-tempo.Rmd"> Shiny Tempo Report</a></h2>
<h2><a href="tempo.html"> Static Tempo Report</a></h2>

</div>

</div>
</div>


</body></html>

0 comments on commit 6d02cd2

Please sign in to comment.