Skip to content

Commit 0e8c265

Browse files
committed
Dockerize
1 parent 9f6d163 commit 0e8c265

File tree

8 files changed

+2358
-7
lines changed

8 files changed

+2358
-7
lines changed

.Rprofile

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
source("renv/activate.R")

R/packages.R

+2-1
Original file line numberDiff line numberDiff line change
@@ -18,15 +18,16 @@
1818
# }
1919
# # ## Other libraries ----
2020
# devtools::install_github("ppernot/ErrViewLib")
21-
# library(lib,character.only = TRUE)
2221

2322
# Cloud deployment ----
2423

2524
library("devtools")
2625
library("shiny")
26+
library("shinythemes")
2727
library("shinyFiles")
2828
library("shinyAce")
2929
library("shinycssloaders")
30+
library("DT")
3031
library("boot")
3132
library("ErrViewLib")
3233
library("data.table")

compressDB.sh

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
tar -cvzf ChemDB.tar.gz ../MC-ChemDB/Neutrals/Source/v_1.3

docker/Dockerfile

+42
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
FROM ppernot1/shiny_base
2+
3+
RUN apt-get install -y --no-install-recommends libharfbuzz-dev libfribidi-dev
4+
5+
## renv
6+
ENV RENV_VERSION 0.15.5
7+
RUN Rscript -e "install.packages('remotes', repos = c(CRAN = 'https://cloud.r-project.org'))"
8+
RUN Rscript -e "remotes::install_github('rstudio/renv@${RENV_VERSION}')"
9+
10+
RUN mkdir MC-ChemDBUI
11+
COPY .Rprofile /MC-ChemDBUI/
12+
COPY renv/activate.R /MC-ChemDBUI/renv/activate.R
13+
COPY renv.lock /MC-ChemDBUI/renv.lock
14+
WORKDIR /MC-ChemDBUI
15+
RUN R -e 'renv::consent(TRUE)' \
16+
&& R -e 'renv::restore()'
17+
18+
## database files
19+
WORKDIR /
20+
RUN mkdir ChemDBPublic
21+
ADD ChemDB.tar.gz /
22+
23+
## app files
24+
COPY global.R /MC-ChemDBUI/
25+
COPY ui.R /MC-ChemDBUI/
26+
COPY server.R /MC-ChemDBUI/
27+
COPY ui_files /MC-ChemDBUI/ui_files/
28+
COPY server_files /MC-ChemDBUI/server_files/
29+
COPY R /MC-ChemDBUI/R/
30+
COPY data /MC-ChemDBUI/data/
31+
WORKDIR /MC-ChemDBUI
32+
33+
34+
## change user from root ### BREAKS renv links !!!
35+
#RUN addgroup --system app \
36+
# && adduser --system --ingroup app app
37+
#RUN chown app:app -R /UncVal
38+
#USER app
39+
40+
## expose port and run app
41+
EXPOSE 3820
42+
CMD ["R", "-e", "shiny::runApp(host = '0.0.0.0', port = 3820)"]

docker/commands.txt

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
BUILD :
2+
1/ cd MC-ChemDBUI
3+
2/ docker build -t ppernot1/mc-chemdbui:v0.1 -t ppernot1/mc-chemdbui:latest -f docker/Dockerfile .
4+
3/ docker login
5+
4/ docker image push --all-tags ppernot1/mc-chemdbui
6+
7+
RUN :
8+
UI :
9+
1/ docker run -d -p 3820:3820 --mount type=bind,source="$(pwd)"/../ChemDBPublic,target=/ChemDBPublic --name mc-chemdbui ppernot1/mc-chemdbui
10+
3/ access http://localhost:3820 in browser
11+
12+
BASH :
13+
* docker run -ti ppernot1/mc-chemdbui bash

global.R

+1-1
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ gPars$mar[3] = 2
2727

2828
# Data paths ####
2929
neutralsSource = file.path('..','MC-ChemDB','Neutrals','Source')
30-
neutralsPublic = file.path('.','ChemDBPublic','Neutrals')
30+
neutralsPublic = file.path('..','ChemDBPublic','Neutrals')
3131

3232
# Load data and functions ####
3333
source('R/massCalc.R')

0 commit comments

Comments
 (0)