Skip to content

Commit

Permalink
Dockerize
Browse files Browse the repository at this point in the history
  • Loading branch information
ppernot committed Jul 21, 2022
1 parent 9f6d163 commit 0e8c265
Show file tree
Hide file tree
Showing 8 changed files with 2,358 additions and 7 deletions.
1 change: 1 addition & 0 deletions .Rprofile
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
source("renv/activate.R")
3 changes: 2 additions & 1 deletion R/packages.R
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,16 @@
# }
# # ## Other libraries ----
# devtools::install_github("ppernot/ErrViewLib")
# library(lib,character.only = TRUE)

# Cloud deployment ----

library("devtools")
library("shiny")
library("shinythemes")
library("shinyFiles")
library("shinyAce")
library("shinycssloaders")
library("DT")
library("boot")
library("ErrViewLib")
library("data.table")
Expand Down
1 change: 1 addition & 0 deletions compressDB.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
tar -cvzf ChemDB.tar.gz ../MC-ChemDB/Neutrals/Source/v_1.3
42 changes: 42 additions & 0 deletions docker/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
FROM ppernot1/shiny_base

RUN apt-get install -y --no-install-recommends libharfbuzz-dev libfribidi-dev

## renv
ENV RENV_VERSION 0.15.5
RUN Rscript -e "install.packages('remotes', repos = c(CRAN = 'https://cloud.r-project.org'))"
RUN Rscript -e "remotes::install_github('rstudio/renv@${RENV_VERSION}')"

RUN mkdir MC-ChemDBUI
COPY .Rprofile /MC-ChemDBUI/
COPY renv/activate.R /MC-ChemDBUI/renv/activate.R
COPY renv.lock /MC-ChemDBUI/renv.lock
WORKDIR /MC-ChemDBUI
RUN R -e 'renv::consent(TRUE)' \
&& R -e 'renv::restore()'

## database files
WORKDIR /
RUN mkdir ChemDBPublic
ADD ChemDB.tar.gz /

## app files
COPY global.R /MC-ChemDBUI/
COPY ui.R /MC-ChemDBUI/
COPY server.R /MC-ChemDBUI/
COPY ui_files /MC-ChemDBUI/ui_files/
COPY server_files /MC-ChemDBUI/server_files/
COPY R /MC-ChemDBUI/R/
COPY data /MC-ChemDBUI/data/
WORKDIR /MC-ChemDBUI


## change user from root ### BREAKS renv links !!!
#RUN addgroup --system app \
# && adduser --system --ingroup app app
#RUN chown app:app -R /UncVal
#USER app

## expose port and run app
EXPOSE 3820
CMD ["R", "-e", "shiny::runApp(host = '0.0.0.0', port = 3820)"]
13 changes: 13 additions & 0 deletions docker/commands.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
BUILD :
1/ cd MC-ChemDBUI
2/ docker build -t ppernot1/mc-chemdbui:v0.1 -t ppernot1/mc-chemdbui:latest -f docker/Dockerfile .
3/ docker login
4/ docker image push --all-tags ppernot1/mc-chemdbui

RUN :
UI :
1/ docker run -d -p 3820:3820 --mount type=bind,source="$(pwd)"/../ChemDBPublic,target=/ChemDBPublic --name mc-chemdbui ppernot1/mc-chemdbui
3/ access http://localhost:3820 in browser

BASH :
* docker run -ti ppernot1/mc-chemdbui bash
2 changes: 1 addition & 1 deletion global.R
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ gPars$mar[3] = 2

# Data paths ####
neutralsSource = file.path('..','MC-ChemDB','Neutrals','Source')
neutralsPublic = file.path('.','ChemDBPublic','Neutrals')
neutralsPublic = file.path('..','ChemDBPublic','Neutrals')

# Load data and functions ####
source('R/massCalc.R')
Expand Down
Loading

0 comments on commit 0e8c265

Please sign in to comment.