From c2539ae066ef1d0486efc385ef40e47f9cd574bc Mon Sep 17 00:00:00 2001
From: Fortune Iriaye <firiaye@uab.edu>
Date: Mon, 24 Feb 2025 16:38:21 -0600
Subject: [PATCH] Update Dockerfile using R as the base image

---
 docker/Dockerfile | 36 +++++++++++++-----------------------
 1 file changed, 13 insertions(+), 23 deletions(-)

diff --git a/docker/Dockerfile b/docker/Dockerfile
index 694fd1a..90c5043 100644
--- a/docker/Dockerfile
+++ b/docker/Dockerfile
@@ -1,4 +1,4 @@
-FROM tensorflow/tensorflow:1.15.0 AS tensorflow
+FROM rocker/rstudio:4.3.3 AS rstudio
 
 # Set noninteractive mode to prevent prompts during installation
 ENV DEBIAN_FRONTEND=noninteractive
@@ -31,32 +31,17 @@ RUN wget https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh -
 ENV PATH="/opt/miniconda/bin:$PATH"
 
 # Create .condarc file for channel priority
-RUN echo "channels:\n  - conda-forge\n  - bioconda\n  - defaults\n  - r" > /root/.condarc
+RUN echo "channels:\n  - conda-forge\n  - bioconda" > /root/.condarc
 
 # Create Conda environment and install dependencies
 RUN conda create --name neuroestimator -y \
-    tensorflow=1.15.0 \
-    tensorflow-estimator=1.15.1 \
-    r-keras=2.3.0.0 \
-    r-tensorflow=2.2.0 \
+    python=3.7 \
     h5py=2.10.0 \
-    hdf5=1.10.6 \
-    r-dplyr=1.0.9 \
-    r-base \
-    r-remotes \
-    'r-reticulate<=1.24'
-
-# Rstudio setup
-FROM rocker/rstudio:4.3.3 AS rstudio
-
-# Set environment variables
-
-ENV DEBIAN_FRONTEND=noninteractive
-ENV PATH="/opt/miniconda/bin:$PATH"
+    hdf5=1.10.6
 
-# Copy Tensorflow and Miniconda environment
-COPY --from=tensorflow /opt/miniconda /opt/miniconda
-COPY --from=tensorflow /root/.condarc /root/.condarc
+# Activate the Conda environment and install Tensorflow via Pip
+RUN /bin/bash -c "source activate neuroestimator && \
+    pip install tensorflow==1.15.0 tensorflow-estimator==1.15.1"
 
 # Create an Rstudio User
 
@@ -68,7 +53,12 @@ RUN id -u rstudio >/dev/null 2>&1 || useradd -m -s /bin/bash rstudio && \
 RUN echo 'export RSTUDIO_WHICH_R="/opt/miniconda/envs/neuroestimator/bin/R"' >> /etc/profile.d/rstudio.sh
 
 # Install NEUROeSTIMator in the Conda environment
-RUN conda run -n neuroestimator R -e "remotes::install_git('https://research-git.uiowa.edu/michaelson-lab-public/neuroestimator')"
+RUN conda run -n neuroestimator Rscript -e "install.packages('remotes')"
+RUN conda run -n neuroestimator Rscript -e "remotes::install_version('dplyr',version='1.0.9')"
+RUN conda run -n neuroestimator Rscript -e "remotes::install_version('keras',version='2.3.0')"
+RUN conda run -n neuroestimator Rscript -e "remotes::install_version('tensorflow',version='2.2.0')"
+RUN conda run -n neuroestimator Rscript -e "remotes::install_version('reticulate',version='1.24')"
+RUN conda run -n neuroestimator Rscript -e "remotes::install_git('https://research-git.uiowa.edu/michaelson-lab-public/neuroestimator')"
 
 # Ensure Conda environment is activated on container start
 SHELL ["/bin/bash", "-c"]
-- 
GitLab