FROM rocker/shiny-verse:4.3.2 # Install system dependencies RUN apt-get update && apt-get install -y \ libcurl4-openssl-dev \ libssl-dev \ libxml2-dev \ libfontconfig1-dev \ libfreetype6-dev \ libpng-dev \ libtiff5-dev \ libjpeg-dev \ && apt-get clean \ && rm -rf /var/lib/apt/lists/* # rocker/shiny-verse already includes shiny, ggplot2, dplyr, tidyverse # Only install packages not bundled in the base image RUN R -e "install.packages('DT', repos='https://cloud.r-project.org')" RUN R -e "install.packages('reshape2', repos='https://cloud.r-project.org')" # Verify all packages load correctly at build time RUN R -e "library(shiny); library(DT); library(ggplot2); library(dplyr); library(reshape2); cat('All packages OK\n')" # Copy app into the Shiny server directory COPY app.R /srv/shiny-server/app/app.R # Configure shiny-server to listen on port 7860 (required by Hugging Face Spaces) RUN printf '\ 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\ }\n' > /etc/shiny-server/shiny-server.conf # Ensure log directory exists and is writable RUN mkdir -p /var/log/shiny-server && chown shiny:shiny /var/log/shiny-server EXPOSE 7860 CMD ["/usr/bin/shiny-server"]