Skip to content
Snippets Groups Projects
Commit e9dbd950 authored by Fortune Iriaye's avatar Fortune Iriaye
Browse files

Update Dockerfile to implement multi-stage build

parent 7594d2fd
No related branches found
No related tags found
No related merge requests found
Pipeline #13330 passed with stage
in 23 minutes and 59 seconds
FROM ubuntu:22.04
FROM tensorflow/tensorflow:1.15.0 AS tensorflow
# Set noninteractive mode to prevent prompts during installation
ENV DEBIAN_FRONTEND=noninteractive
......@@ -10,7 +10,7 @@ RUN apt-get update && apt-get install -y \
curl \
git \
build-essential \
libcurl4-openssl-dev \
libcurl4-openssl-dev || apt-get install -y libcurl4-gnutls-dev \
libssl-dev \
libxml2-dev \
libxt-dev \
......@@ -22,13 +22,6 @@ RUN apt-get update && apt-get install -y \
psmisc \
&& rm -rf /var/lib/apt/lists/*
# Create an RStudio user with sudo access
RUN useradd -m -s /bin/bash rstudio && echo "rstudio:rstudio" | chpasswd && \
usermod -aG sudo rstudio
# Set working directory
WORKDIR /root
# Install Miniconda
RUN wget https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh -O miniconda.sh && \
bash miniconda.sh -b -p /opt/miniconda && \
......@@ -42,7 +35,6 @@ RUN echo "channels:\n - conda-forge\n - bioconda\n - defaults\n - r" > /root
# Create Conda environment and install dependencies
RUN conda create --name neuroestimator -y \
r-essentials \
tensorflow=1.15.0 \
tensorflow-estimator=1.15.1 \
r-keras=2.3.0.0 \
......@@ -54,10 +46,23 @@ RUN conda create --name neuroestimator -y \
r-remotes \
'r-reticulate<=1.24'
# Install RStudio Server
RUN wget https://download2.rstudio.org/server/jammy/amd64/rstudio-server-2024.12.1-563-amd64.deb -O rstudio-server.deb && \
dpkg -i rstudio-server.deb || apt-get -f install -y && \
rm rstudio-server.deb
# Rstudio setup
FROM rocker/rstudio:4.3.3 AS rstudio
# Set environment variables
ENV DEBIAN_FRONTEND=noninteractive
ENV PATH="/opt/miniconda/bin:$PATH"
# Copy Tensorflow and Miniconda environment
COPY --from=tensorflow /opt/miniconda /opt/miniconda
COPY --from=tensorflow /root/.condarc /root/.condarc
# Create an Rstudio User
RUN id -u rstudio >/dev/null 2>&1 || useradd -m -s /bin/bash rstudio && \
echo "rstudio:rstudio" | chpasswd && \
usermod -aG sudo rstudio
# Ensure RStudio uses Conda's R
RUN echo 'export RSTUDIO_WHICH_R="/opt/miniconda/envs/neuroestimator/bin/R"' >> /etc/profile.d/rstudio.sh
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment