FROM rocker/shiny-verse:latest # Set up a new user named "user" with user ID 1000 RUN useradd -m -u 1000 user # Switch to the "user" user USER user # Set home to the user's home directory ENV HOME=/home/user \ PATH=/home/user/.local/bin:$PATH \ R_LIBS_USER=/home/user/R/library # Create a personal R library directory RUN mkdir -p /home/user/R/library # Set the working directory to the user's home directory WORKDIR $HOME/app # Copy the current directory contents into the container at $HOME/app setting the owner to the user COPY --chown=user . $HOME/app # Install stable packages from CRAN RUN install2.r --error \ bslib \ httpuv \ purrr \ glue \ httr2 RUN --mount=type=secret,id=OPENAI_API_KEY,mode=0444,required=true \ echo "OPENAI_API_KEY=$(cat /run/secrets/OPENAI_API_KEY)" >> $HOME/.Renviron EXPOSE 7860 CMD ["R", "--quiet", "-e", "shiny::runApp(host='0.0.0.0', port=7860)"]