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

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +46 -18
Dockerfile CHANGED
@@ -1,34 +1,62 @@
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)"]
 
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
+ parallel \
38
+ shinydashboard \
39
+ reticulate \
40
+ remotes
41
+
42
+ # ------------------------------------------------------------------------------
43
+ # 3) Copy your local code (including app.R and CODEBASE) into the container
44
+ # ------------------------------------------------------------------------------
45
+ COPY . .
46
 
47
+ # If your fastrerandomize package is on GitHub and not installed yet,
48
+ # uncomment and adjust the GitHub URL as appropriate:
49
  RUN Rscript -e "remotes::install_github('cjerzak/fastrerandomize-software/fastrerandomize')"
50
 
51
+ # ------------------------------------------------------------------------------
52
+ # 4) (Optional) Pre-build the conda environment inside the Docker image
53
+ # by calling your 'build_backend()' function.
54
+ # This ensures that JAX/numpy are already installed.
55
+ # ------------------------------------------------------------------------------
56
  RUN Rscript -e "library(fastrerandomize); fastrerandomize::build_backend(conda='auto')"
57
 
58
+ # ------------------------------------------------------------------------------
59
+ # 5) Expose the Shiny port and set default command to run the Shiny app
60
+ # ------------------------------------------------------------------------------
61
  EXPOSE 7860
 
 
62
  CMD ["R", "--quiet", "-e", "shiny::runApp('/code', host='0.0.0.0', port=7860)"]