cjerzak commited on
Commit
c4fdb31
·
verified ·
1 Parent(s): 9443444

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +19 -46
Dockerfile CHANGED
@@ -1,61 +1,34 @@
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 "library(fastrerandomize); fastrerandomize::build_backend(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)"]
 
 
 
1
+ # Use the Miniconda3 base image
2
+ FROM continuumio/miniconda3
3
 
4
+ # Set the working directory to /code
5
  WORKDIR /code
6
 
7
+ # Install system dependencies
 
 
8
  RUN apt-get update -y && \
9
  apt-get install -y --no-install-recommends \
10
  wget \
11
  bzip2 \
12
  && rm -rf /var/lib/apt/lists/*
13
 
14
+ # Install R using conda
15
+ RUN conda install -y r-base && \
16
+ conda clean -afy
17
+
18
+ # Install required R packages from CRAN
19
+ RUN Rscript -e "install.packages(c('shiny', 'dplyr', 'parallel', 'ggplot2', 'readr', 'ggExtra', 'DT', 'shinydashboard', 'reticulate', 'remotes'), repos='https://cloud.r-project.org/')"
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
20
 
21
+ # Install the fastrerandomize package from GitHub
 
22
  RUN Rscript -e "remotes::install_github('cjerzak/fastrerandomize-software/fastrerandomize')"
23
 
24
+ # Copy local code into the container
25
+ COPY . .
26
+
27
+ # Pre-build the conda environment for Python dependencies
 
28
  RUN Rscript -e "library(fastrerandomize); fastrerandomize::build_backend(conda='auto')"
29
 
30
+ # Expose the Shiny app port
 
 
31
  EXPOSE 7860
32
+
33
+ # Set the command to run the Shiny app
34
+ CMD ["R", "--quiet", "-e", "shiny::runApp('/code', host='0.0.0.0', port=7860)"]