Spaces:
Sleeping
Sleeping
Update Dockerfile
Browse files- Dockerfile +55 -11
Dockerfile
CHANGED
|
@@ -1,7 +1,7 @@
|
|
| 1 |
-
#
|
| 2 |
FROM rocker/shiny:4.3.1
|
| 3 |
|
| 4 |
-
# Install
|
| 5 |
RUN apt-get update && apt-get install -y \
|
| 6 |
libcurl4-openssl-dev \
|
| 7 |
libssl-dev \
|
|
@@ -12,21 +12,65 @@ RUN apt-get update && apt-get install -y \
|
|
| 12 |
&& apt-get clean \
|
| 13 |
&& rm -rf /var/lib/apt/lists/*
|
| 14 |
|
| 15 |
-
# Install
|
| 16 |
-
RUN R -e "install.packages(c('shiny', 'shinydashboard', 'DT', 'ggplot2', 'plotly', 'dplyr', 'tidyr', 'RColorBrewer'
|
| 17 |
|
| 18 |
-
# Create app directory
|
| 19 |
-
RUN mkdir -p /
|
|
|
|
| 20 |
|
| 21 |
-
# Copy app
|
| 22 |
-
COPY app.R /
|
| 23 |
|
| 24 |
-
#
|
| 25 |
-
RUN
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 26 |
|
| 27 |
# Set permissions
|
| 28 |
-
RUN chown -R shiny:shiny /
|
|
|
|
| 29 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 30 |
EXPOSE 7860
|
| 31 |
|
|
|
|
| 32 |
CMD ["/usr/bin/shiny-server"]
|
|
|
|
| 1 |
+
# Use R Studio's Rocker image with Shiny Server for Hugging Face
|
| 2 |
FROM rocker/shiny:4.3.1
|
| 3 |
|
| 4 |
+
# Install system dependencies
|
| 5 |
RUN apt-get update && apt-get install -y \
|
| 6 |
libcurl4-openssl-dev \
|
| 7 |
libssl-dev \
|
|
|
|
| 12 |
&& apt-get clean \
|
| 13 |
&& rm -rf /var/lib/apt/lists/*
|
| 14 |
|
| 15 |
+
# Install R packages
|
| 16 |
+
RUN R -e "install.packages(c('shiny', 'shinydashboard', 'DT', 'ggplot2', 'plotly', 'dplyr', 'tidyr', 'RColorBrewer'), repos='https://cloud.r-project.org/')"
|
| 17 |
|
| 18 |
+
# Create app directory (MUST match Shiny Server's default location)
|
| 19 |
+
RUN mkdir -p /srv/shiny-server/qtl-app
|
| 20 |
+
RUN mkdir -p /srv/shiny-server/sample-apps
|
| 21 |
|
| 22 |
+
# Copy app files to the correct location
|
| 23 |
+
COPY app.R /srv/shiny-server/qtl-app/
|
| 24 |
|
| 25 |
+
# Create a default index page that redirects to our app
|
| 26 |
+
RUN echo '\
|
| 27 |
+
<!DOCTYPE html>\n\
|
| 28 |
+
<html>\n\
|
| 29 |
+
<head>\n\
|
| 30 |
+
<meta http-equiv="refresh" content="0; url=/qtl-app/" />\n\
|
| 31 |
+
<title>QTL Mapping Suite</title>\n\
|
| 32 |
+
</head>\n\
|
| 33 |
+
<body>\n\
|
| 34 |
+
<p>Redirecting to QTL Mapping Suite...</p>\n\
|
| 35 |
+
</body>\n\
|
| 36 |
+
</html>\n\
|
| 37 |
+
' > /srv/shiny-server/index.html
|
| 38 |
|
| 39 |
# Set permissions
|
| 40 |
+
RUN chown -R shiny:shiny /srv/shiny-server
|
| 41 |
+
RUN chmod -R 755 /srv/shiny-server
|
| 42 |
|
| 43 |
+
# Use the default Shiny Server config but ensure it serves our app
|
| 44 |
+
RUN echo '\
|
| 45 |
+
# Instruct Shiny Server to run applications as the user "shiny"\n\
|
| 46 |
+
run_as shiny;\n\
|
| 47 |
+
\n\
|
| 48 |
+
# Define a server that listens on port 7860\n\
|
| 49 |
+
server {\n\
|
| 50 |
+
listen 7860;\n\
|
| 51 |
+
\n\
|
| 52 |
+
# Define a location at the base URL\n\
|
| 53 |
+
location / {\n\
|
| 54 |
+
# Host the directory of Shiny Apps stored in this directory\n\
|
| 55 |
+
site_dir /srv/shiny-server;\n\
|
| 56 |
+
\n\
|
| 57 |
+
# Log directory\n\
|
| 58 |
+
log_dir /var/log/shiny-server;\n\
|
| 59 |
+
\n\
|
| 60 |
+
# Increase timeouts for QTL analysis\n\
|
| 61 |
+
app_init_timeout 300;\n\
|
| 62 |
+
app_idle_timeout 600;\n\
|
| 63 |
+
}\n\
|
| 64 |
+
\n\
|
| 65 |
+
# Define a specific location for our QTL app\n\
|
| 66 |
+
location /qtl-app {\n\
|
| 67 |
+
app_dir /srv/shiny-server/qtl-app;\n\
|
| 68 |
+
}\n\
|
| 69 |
+
}\n\
|
| 70 |
+
' > /etc/shiny-server/shiny-server.conf
|
| 71 |
+
|
| 72 |
+
# Expose port
|
| 73 |
EXPOSE 7860
|
| 74 |
|
| 75 |
+
# Start Shiny Server
|
| 76 |
CMD ["/usr/bin/shiny-server"]
|