-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
62 lines (49 loc) · 1.46 KB
/
Dockerfile
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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
# Build stage
FROM rocker/shiny:4 AS builder
ENV HOST 0.0.0.0
# Install system dependencies and clean up in a single RUN statement
RUN apt-get update && apt-get install --no-install-recommends -y \
libv8-dev \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/* \
/tmp/downloaded_packages/ /tmp/*.rds
# Install R packages in one layer to leverage Docker caching
RUN install2.r --error --skipinstalled -n 4 \
remotes \
apexcharter \
config \
dplyr \
golem \
deckgl \
reactable \
reactablefmtr \
shiny \
rlang \
scales \
htmlwidgets \
memoise \
purrr \
viridisLite \
V8
# Final stage
FROM rocker/shiny
# Copy installed R packages from builder
COPY --from=builder /usr/local/lib/R /usr/local/lib/R
# Copy application files
COPY multimedia_reduced.parquet /srv/shiny-server/multimedia_reduced.parquet
COPY occurrence_country /srv/shiny-server/occurrence_country
COPY styles.css /srv/shiny-server/styles.css
COPY R /srv/shiny-server/R
COPY DESCRIPTION /srv/shiny-server/DESCRIPTION
COPY NAMESPACE /srv/shiny-server/NAMESPACE
COPY app.R /srv/shiny-server/app.R
# Install the local package
RUN Rscript -e 'remotes::install_local("/srv/shiny-server", dependencies = FALSE)'
# Copy Shiny server configuration
COPY shiny.config /etc/shiny-server/shiny-server.conf
# Expose the port for the Shiny app
EXPOSE 8080
# Use the 'shiny' user to run the app
USER shiny
# Start the Shiny server
CMD ["/usr/bin/shiny-server"]