cjerzak commited on
Commit
024b43b
·
verified ·
1 Parent(s): 18dccd9

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +50 -3
Dockerfile CHANGED
@@ -1,14 +1,61 @@
 
1
  FROM rocker/r-base:latest
2
 
 
3
  WORKDIR /code
4
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
5
  RUN install2.r --error \
6
  shiny \
7
  dplyr \
8
  ggplot2 \
9
  readr \
10
- ggExtra
11
-
 
 
 
 
 
 
 
12
  COPY . .
13
 
14
- CMD ["R", "--quiet", "-e", "shiny::runApp(host='0.0.0.0', port=7860)"]
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Use the R base image
2
  FROM rocker/r-base:latest
3
 
4
+ # Switch to /code as our working directory
5
  WORKDIR /code
6
 
7
+ # ------------------------------------------------------------------------------
8
+ # 1) Install system dependencies + Miniconda
9
+ # ------------------------------------------------------------------------------
10
+ RUN apt-get update -y && \
11
+ apt-get install -y --no-install-recommends \
12
+ wget \
13
+ bzip2 \
14
+ && rm -rf /var/lib/apt/lists/*
15
+
16
+ # Install Miniconda to /opt/conda
17
+ RUN wget --quiet https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh -O /tmp/miniconda.sh \
18
+ && /bin/bash /tmp/miniconda.sh -b -p /opt/conda \
19
+ && rm /tmp/miniconda.sh \
20
+ && /opt/conda/bin/conda clean -afy
21
+
22
+ # Make sure conda is on PATH
23
+ ENV PATH=/opt/conda/bin:$PATH
24
+
25
+ # ------------------------------------------------------------------------------
26
+ # 2) Install required R packages
27
+ # (We add reticulate + a few extras such as DT and shinydashboard
28
+ # since your app uses them.)
29
+ # ------------------------------------------------------------------------------
30
  RUN install2.r --error \
31
  shiny \
32
  dplyr \
33
  ggplot2 \
34
  readr \
35
+ ggExtra \
36
+ DT \
37
+ shinydashboard \
38
+ reticulate \
39
+ remotes
40
+
41
+ # ------------------------------------------------------------------------------
42
+ # 3) Copy your local code (including app.R and CODEBASE) into the container
43
+ # ------------------------------------------------------------------------------
44
  COPY . .
45
 
46
+ # If your `fastrerandomize` package is on GitHub and not installed yet,
47
+ # uncomment and adjust the GitHub URL as appropriate:
48
+ # RUN Rscript -e "remotes::install_github('cjerzak/fastrerandomize-software/fastrerandomize')"
49
+
50
+ # ------------------------------------------------------------------------------
51
+ # 4) (Optional) Pre-build the conda environment inside the Docker image
52
+ # by calling your 'build_backend()' function.
53
+ # This ensures that JAX/numpy are already installed.
54
+ # ------------------------------------------------------------------------------
55
+ RUN Rscript -e "source('CODEBASE'); build_backend(conda_env='fastrerandomize', conda='auto')"
56
+
57
+ # ------------------------------------------------------------------------------
58
+ # 5) Expose the Shiny port and set default command to run the Shiny app
59
+ # ------------------------------------------------------------------------------
60
+ EXPOSE 7860
61
+ CMD ["R", "--quiet", "-e", "shiny::runApp('/code', host='0.0.0.0', port=7860)"]