Update Dockerfile
Browse files- Dockerfile +22 -7
Dockerfile
CHANGED
@@ -1,14 +1,29 @@
|
|
1 |
FROM rocker/r-base:latest
|
2 |
|
|
|
3 |
WORKDIR /code
|
4 |
|
5 |
-
|
6 |
-
|
7 |
-
|
8 |
-
sf
|
9 |
-
|
10 |
-
|
11 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
12 |
COPY . .
|
13 |
|
|
|
14 |
CMD ["R", "--quiet", "-e", "shiny::runApp(host='0.0.0.0', port=7860)"]
|
|
|
1 |
FROM rocker/r-base:latest
|
2 |
|
3 |
+
# Set the working directory inside the container
|
4 |
WORKDIR /code
|
5 |
|
6 |
+
# Install system dependencies required by R packages (sf, leaflet, etc.)
|
7 |
+
RUN apt-get update && apt-get install -y \
|
8 |
+
libcurl4-openssl-dev \ # For curl support in R
|
9 |
+
libssl-dev \ # For SSL support in R packages like sf and leaflet
|
10 |
+
libxml2-dev \ # For XML support, used by some R packages
|
11 |
+
libgdal-dev \ # For geospatial data processing (needed by sf)
|
12 |
+
libgeos-dev \ # For geometry processing (needed by sf)
|
13 |
+
libproj-dev \ # For coordinate reference system (CRS) support (needed by sf)
|
14 |
+
libnetcdf-dev \ # For NetCDF support (could be used by sf or other spatial packages)
|
15 |
+
&& rm -rf /var/lib/apt/lists/* # Clean up apt cache to reduce image size
|
16 |
+
|
17 |
+
# Install R packages from CRAN using remotes (to avoid installation errors from install2.r)
|
18 |
+
RUN R -e "install.packages('remotes')" \
|
19 |
+
&& R -e "remotes::install_cran('shiny')" \ # Install shiny package
|
20 |
+
&& R -e "remotes::install_cran('dplyr')" \ # Install dplyr package
|
21 |
+
&& R -e "remotes::install_cran('sf')" \ # Install sf package (geospatial)
|
22 |
+
&& R -e "remotes::install_cran('stringr')" \ # Install stringr package
|
23 |
+
&& R -e "remotes::install_cran('leaflet')" # Install leaflet package (for mapping)
|
24 |
+
|
25 |
+
# Copy the application code into the container
|
26 |
COPY . .
|
27 |
|
28 |
+
# Set the default command to run the Shiny app on port 7860
|
29 |
CMD ["R", "--quiet", "-e", "shiny::runApp(host='0.0.0.0', port=7860)"]
|