File size: 2,666 Bytes
4a8ebfc
 
 
d60cfb3
 
4a8ebfc
d60cfb3
 
4a8ebfc
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
d60cfb3
 
 
 
 
4a8ebfc
 
 
8c29c75
4a8ebfc
 
 
 
 
 
 
d60cfb3
 
4a8ebfc
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
# ------------------------------------------------------------------------------
# 0) Use the R base image
# ------------------------------------------------------------------------------
FROM rocker/r-base:latest

# Switch to /code as our working directory
WORKDIR /code

# ------------------------------------------------------------------------------
# 1) Install system dependencies + Miniconda
# ------------------------------------------------------------------------------
RUN apt-get update -y && \
    apt-get install -y --no-install-recommends \
        wget \
        bzip2 \
        git \
        libcurl4-openssl-dev \
        libssl-dev \
        libxml2-dev \
    && rm -rf /var/lib/apt/lists/*

# Install Miniconda to /opt/conda
RUN wget --quiet https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh -O /tmp/miniconda.sh \
    && /bin/bash /tmp/miniconda.sh -b -p /opt/conda \
    && rm /tmp/miniconda.sh \
    && /opt/conda/bin/conda clean -afy

# Make sure conda is on PATH
ENV PATH=/opt/conda/bin:$PATH

# ------------------------------------------------------------------------------
# 2) Install required R packages
# ------------------------------------------------------------------------------
RUN install2.r --error \
    shiny \
    dplyr \
    ggplot2 \
    readr \
    ggExtra \
    DT \
    parallel \
    sandwich \ 
    shinydashboard \
    reticulate \
    remotes

# ------------------------------------------------------------------------------
# 3) Copy your local code (including app.R and data) into the container
# ------------------------------------------------------------------------------
COPY . .

# ------------------------------------------------------------------------------
# 4) Install strategize from GitHub
# ------------------------------------------------------------------------------
RUN Rscript -e "remotes::install_github('cjerzak/strategize-software/strategize')"

# ------------------------------------------------------------------------------
# 5) Pre-build the conda environment inside the Docker image by 
#    calling your 'build_backend()' function, which handles the JAX/numpy install.
# ------------------------------------------------------------------------------
RUN Rscript -e "library(strategize); strategize::build_backend(conda='auto')"

# ------------------------------------------------------------------------------
# 6) Expose the Shiny port (7860) and set the default command to run the Shiny app
# ------------------------------------------------------------------------------
EXPOSE 7860
CMD ["R", "--quiet", "-e", "shiny::runApp('/code', host='0.0.0.0', port=7860)"]