# Use R Shiny image FROM rocker/shiny:latest # Install necessary Linux dependencies # CMake and libnlopt-dev added for nloptr RUN apt-get update && apt-get install -y \ libcurl4-gnutls-dev \ libssl-dev \ libxml2-dev \ libudunits2-dev \ libgdal-dev \ libcairo2-dev \ libxt-dev \ libpq-dev \ libssh2-1-dev \ libharfbuzz-dev \ libfribidi-dev \ libgsl0-dev \ cmake \ libnlopt-dev \ libglpk-dev # Clean up the apt cache to reduce the image size RUN apt-get clean && \ rm -rf /var/lib/apt/lists/* # Copy your application files COPY . /usr/src/app RUN chown -R shiny:shiny /usr/src/app # Set the working directory WORKDIR /usr/src/app # Install renv and restore packages RUN Rscript -e 'install.packages("renv")' RUN Rscript -e 'renv::restore()' # Expose the port the app runs on EXPOSE 7860 CMD ["R", "--quiet", "-e", "shiny::runApp(host='0.0.0.0', port=7860)"]