Spaces:
Running
Running
Update Dockerfile
Browse files- Dockerfile +55 -3
Dockerfile
CHANGED
@@ -1,14 +1,66 @@
|
|
|
|
|
|
|
|
1 |
FROM rocker/r-base:latest
|
2 |
|
|
|
3 |
WORKDIR /code
|
4 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
5 |
RUN install2.r --error \
|
6 |
shiny \
|
7 |
dplyr \
|
8 |
ggplot2 \
|
9 |
readr \
|
10 |
-
ggExtra
|
11 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
12 |
COPY . .
|
13 |
|
14 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# ------------------------------------------------------------------------------
|
2 |
+
# 0) Use the R base image
|
3 |
+
# ------------------------------------------------------------------------------
|
4 |
FROM rocker/r-base:latest
|
5 |
|
6 |
+
# Switch to /code as our working directory
|
7 |
WORKDIR /code
|
8 |
|
9 |
+
# ------------------------------------------------------------------------------
|
10 |
+
# 1) Install system dependencies + Miniconda
|
11 |
+
# ------------------------------------------------------------------------------
|
12 |
+
RUN apt-get update -y && \
|
13 |
+
apt-get install -y --no-install-recommends \
|
14 |
+
wget \
|
15 |
+
bzip2 \
|
16 |
+
git \
|
17 |
+
libcurl4-openssl-dev \
|
18 |
+
libssl-dev \
|
19 |
+
libxml2-dev \
|
20 |
+
&& rm -rf /var/lib/apt/lists/*
|
21 |
+
|
22 |
+
# Install Miniconda to /opt/conda
|
23 |
+
RUN wget --quiet https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh -O /tmp/miniconda.sh \
|
24 |
+
&& /bin/bash /tmp/miniconda.sh -b -p /opt/conda \
|
25 |
+
&& rm /tmp/miniconda.sh \
|
26 |
+
&& /opt/conda/bin/conda clean -afy
|
27 |
+
|
28 |
+
# Make sure conda is on PATH
|
29 |
+
ENV PATH=/opt/conda/bin:$PATH
|
30 |
+
|
31 |
+
# ------------------------------------------------------------------------------
|
32 |
+
# 2) Install required R packages
|
33 |
+
# ------------------------------------------------------------------------------
|
34 |
RUN install2.r --error \
|
35 |
shiny \
|
36 |
dplyr \
|
37 |
ggplot2 \
|
38 |
readr \
|
39 |
+
ggExtra \
|
40 |
+
DT \
|
41 |
+
parallel \
|
42 |
+
shinydashboard \
|
43 |
+
reticulate \
|
44 |
+
remotes
|
45 |
+
|
46 |
+
# ------------------------------------------------------------------------------
|
47 |
+
# 3) Copy your local code (including app.R and data) into the container
|
48 |
+
# ------------------------------------------------------------------------------
|
49 |
COPY . .
|
50 |
|
51 |
+
# ------------------------------------------------------------------------------
|
52 |
+
# 4) Install strategize from GitHub
|
53 |
+
# ------------------------------------------------------------------------------
|
54 |
+
RUN Rscript -e "remotes::install_github('cjerzak/strategize-software/strategize')"
|
55 |
+
|
56 |
+
# ------------------------------------------------------------------------------
|
57 |
+
# 5) Pre-build the conda environment inside the Docker image by
|
58 |
+
# calling your 'build_backend()' function, which handles the JAX/numpy install.
|
59 |
+
# ------------------------------------------------------------------------------
|
60 |
+
RUN Rscript -e "library(strategize); strategize::build_backend(conda='auto')"
|
61 |
+
|
62 |
+
# ------------------------------------------------------------------------------
|
63 |
+
# 6) Expose the Shiny port (7860) and set the default command to run the Shiny app
|
64 |
+
# ------------------------------------------------------------------------------
|
65 |
+
EXPOSE 7860
|
66 |
+
CMD ["R", "--quiet", "-e", "shiny::runApp('/code', host='0.0.0.0', port=7860)"]
|