File size: 1,543 Bytes
b751abe
 
499082b
b751abe
 
499082b
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
b751abe
 
499082b
b751abe
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
FROM rocker/r-base:latest

# Set the working directory inside the container
WORKDIR /code

# Install system dependencies required by R packages (sf, leaflet, etc.)
RUN apt-get update && apt-get install -y \
    libcurl4-openssl-dev \   # For curl support in R
    libssl-dev \             # For SSL support in R packages like sf and leaflet
    libxml2-dev \            # For XML support, used by some R packages
    libgdal-dev \            # For geospatial data processing (needed by sf)
    libgeos-dev \            # For geometry processing (needed by sf)
    libproj-dev \            # For coordinate reference system (CRS) support (needed by sf)
    libnetcdf-dev \          # For NetCDF support (could be used by sf or other spatial packages)
    && rm -rf /var/lib/apt/lists/*  # Clean up apt cache to reduce image size

# Install R packages from CRAN using remotes (to avoid installation errors from install2.r)
RUN R -e "install.packages('remotes')" \
    && R -e "remotes::install_cran('shiny')" \  # Install shiny package
    && R -e "remotes::install_cran('dplyr')" \   # Install dplyr package
    && R -e "remotes::install_cran('sf')" \      # Install sf package (geospatial)
    && R -e "remotes::install_cran('stringr')" \ # Install stringr package
    && R -e "remotes::install_cran('leaflet')"   # Install leaflet package (for mapping)

# Copy the application code into the container
COPY . .

# Set the default command to run the Shiny app on port 7860
CMD ["R", "--quiet", "-e", "shiny::runApp(host='0.0.0.0', port=7860)"]