qtl / Dockerfile
softwareDevelopment's picture
Update Dockerfile
7a89fae verified
Raw History Blame
1.23 kB
FROM rocker/shiny:4.3.2
# Install system dependencies (with retry to handle transient mirror sync errors)
RUN for i in 1 2 3; do \
apt-get update -o Acquire::Retries=3 && break || sleep 10; \
done \
&& apt-get install -y --fix-missing --no-install-recommends \
libcurl4-openssl-dev \
libssl-dev \
libxml2-dev \
&& rm -rf /var/lib/apt/lists/*
# Install required R packages
RUN R -e "install.packages(c('shiny', 'htmltools'), repos='https://cran.rstudio.com/', dependencies=TRUE)"
# HuggingFace Spaces runs on port 7860
ENV PORT=7860
EXPOSE 7860
# Copy app files into the Shiny server directory
COPY app.R /srv/shiny-server/app/app.R
# Override Shiny Server config to use port 7860
RUN echo 'run_as shiny;\n\
\n\
server {\n\
listen 7860;\n\
\n\
location / {\n\
site_dir /srv/shiny-server/app;\n\
log_dir /var/log/shiny-server;\n\
directory_index on;\n\
}\n\
}' > /etc/shiny-server/shiny-server.conf
# Fix permissions
RUN chown -R shiny:shiny /srv/shiny-server/app \
&& chmod -R 755 /srv/shiny-server/app
# HuggingFace requires the container to run as a non-root user (UID 1000)
RUN usermod -u 1000 shiny && groupmod -g 1000 shiny
USER shiny
CMD ["/usr/bin/shiny-server"]