bug-man/HF_Shiny_Maxdiff_Calculation_Automation
0
1FROM rocker/shiny-verse:latest
2
3# Install system dependencies
4RUN apt-get update && apt-get install -y \
5 libcurl4-openssl-dev \
6 libssl-dev \
7 libxml2-dev \
8 libcairo2-dev \
9 libxt-dev \
10 libssh2-1-dev
11
12# Install R packages
13RUN R -e "install.packages(c('shiny', 'openxlsx', 'dplyr', 'readr', 'haven', 'readxl'), repos='https://cloud.r-project.org/')"
14
15# Set up a new user named "user" with user ID 1000
16RUN useradd -m -u 1000 user
17
18# Set up the app directory and change ownership
19RUN mkdir -p /home/user/app && chown -R user:user /home/user/app
20
21# Switch to the "user" user
22USER user
23
24# Set home to the user's home directory
25ENV HOME=/home/user \
26 PATH=/home/user/.local/bin:$PATH
27
28# Set the working directory to the user's home directory
29WORKDIR $HOME/app
30
31# Copy the application files
32COPY --chown=user . $HOME/app
33
34# Expose the port Shiny runs on
35EXPOSE 7860
36
37# Add a health check
38HEALTHCHECK --interval=30s --timeout=30s --start-period=5s --retries=3 \
39 CMD curl -f http://localhost:7860 || exit 1
40
41# Run the Shiny app
42CMD ["R", "-e", "shiny::runApp('/home/user/app', host = '0.0.0.0', port = 7860)"]