# Use rocker/geospatial as the base image to include necessary geospatial libraries | |
FROM rocker/geospatial:latest | |
# Set the working directory inside the container | |
WORKDIR /code | |
# Install required R packages, specifying the CRAN repository for reliability. | |
# Note: "cartogram" has been removed to avoid the dependency error for rnaturalearthhires. | |
RUN install2.r --error --deps TRUE --repos "https://cran.r-project.org" \ | |
shiny \ | |
shinydashboard \ | |
dplyr \ | |
readr \ | |
sf \ | |
ggplot2 \ | |
rnaturalearth \ | |
rnaturalearthdata \ | |
countrycode \ | |
DT \ | |
ggExtra \ | |
viridis | |
# Copy all files from the current directory to the container's working directory | |
COPY . . | |
# Expose port 7860 to allow external access to the Shiny app | |
EXPOSE 7860 | |
# Command to run the Shiny app when the container starts | |
CMD ["R", "--quiet", "-e", "shiny::runApp(host='0.0.0.0', port=7860)"] |