File size: 1,343 Bytes
261b646
5bc898d
f19490e
 
 
 
 
 
 
 
 
 
 
 
5bc898d
261b646
 
 
 
2be49ea
 
 
5bc898d
f19490e
 
 
2be49ea
f19490e
 
 
 
 
 
 
 
 
 
 
2be49ea
 
 
f19490e
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
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"]