Spaces:
Running
Running
Update Dockerfile
Browse files- Dockerfile +19 -46
Dockerfile
CHANGED
|
@@ -1,61 +1,34 @@
|
|
| 1 |
-
# Use the
|
| 2 |
-
FROM
|
| 3 |
|
| 4 |
-
#
|
| 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
|
| 17 |
-
RUN
|
| 18 |
-
|
| 19 |
-
|
| 20 |
-
|
| 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 |
-
#
|
| 47 |
-
# uncomment and adjust the GitHub URL as appropriate:
|
| 48 |
RUN Rscript -e "remotes::install_github('cjerzak/fastrerandomize-software/fastrerandomize')"
|
| 49 |
|
| 50 |
-
#
|
| 51 |
-
|
| 52 |
-
|
| 53 |
-
#
|
| 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 |
-
|
|
|
|
|
|
|
|
|
| 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)"]
|