# Dockerfile for Hugging Face Spaces - R Shiny App # Risk Monitoring Dashboard FROM rocker/shiny:4.3.2 # Install system dependencies RUN apt-get update && apt-get install -y \ libcurl4-gnutls-dev \ libssl-dev \ libxml2-dev \ libfontconfig1-dev \ libfreetype6-dev \ libpng-dev \ libtiff5-dev \ libjpeg-dev \ libharfbuzz-dev \ libfribidi-dev \ libgdal-dev \ libgeos-dev \ libproj-dev \ libudunits2-dev \ pandoc \ && rm -rf /var/lib/apt/lists/* # Install R packages RUN R -e "install.packages(c(\ 'shiny', \ 'bslib', \ 'leaflet', \ 'plotly', \ 'DT', \ 'dplyr', \ 'lubridate' \ ), repos='https://cloud.r-project.org/')" # Create app directory RUN mkdir -p /srv/shiny-server/app # Copy app files COPY app.R /srv/shiny-server/app/ # Set permissions RUN chown -R shiny:shiny /srv/shiny-server/app # Expose port (Hugging Face uses 7860) EXPOSE 7860 # Configure shiny-server to use port 7860 RUN echo "run_as shiny;\n\ server {\n\ listen 7860;\n\ location / {\n\ site_dir /srv/shiny-server/app;\n\ log_dir /var/log/shiny-server;\n\ directory_index on;\n\ }\n\ }" > /etc/shiny-server/shiny-server.conf # Start shiny-server CMD ["/usr/bin/shiny-server"]