Spaces:
Running
Running
Update Dockerfile
Browse files- Dockerfile +23 -16
Dockerfile
CHANGED
@@ -1,28 +1,19 @@
|
|
1 |
-
# Stage 1:
|
2 |
FROM rocker/shiny:4.0.0 AS builder
|
3 |
|
4 |
# Install git and openssh-client
|
5 |
RUN apt-get update && apt-get install -y git openssh-client
|
6 |
|
7 |
-
# Generate SSH key pair
|
8 |
-
RUN ssh-keygen -t rsa -b 4096 -C "your_email@example.com" -f /root/.ssh/id_rsa -N ''
|
9 |
-
|
10 |
-
# Add GitHub to known hosts
|
11 |
-
RUN ssh-keyscan github.com >> /root/.ssh/known_hosts
|
12 |
-
|
13 |
-
# Clone the repository
|
14 |
-
ARG UN
|
15 |
-
ARG FILE
|
16 |
-
RUN git clone git@github.com:${UN}/${FILE}.git /srv/shiny-server/app
|
17 |
-
|
18 |
-
|
19 |
# Stage 2: Final image
|
20 |
FROM rocker/shiny:4.0.0
|
21 |
|
22 |
-
# Copy
|
23 |
-
COPY --from=builder /
|
|
|
|
|
|
|
24 |
|
25 |
-
# Set working directory
|
26 |
WORKDIR /srv/shiny-server/app
|
27 |
|
28 |
# Install additional R packages
|
@@ -35,6 +26,22 @@ RUN install2.r --error \
|
|
35 |
zoo \
|
36 |
dplyr
|
37 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
38 |
# Set Auth0 config file path
|
39 |
RUN echo "options(auth0_find_config_file = '/srv/shiny-server/app/_auth0.yml')" > /usr/local/lib/R/etc/Rprofile.site
|
40 |
|
|
|
1 |
+
# Stage 1: Base image for building
|
2 |
FROM rocker/shiny:4.0.0 AS builder
|
3 |
|
4 |
# Install git and openssh-client
|
5 |
RUN apt-get update && apt-get install -y git openssh-client
|
6 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
7 |
# Stage 2: Final image
|
8 |
FROM rocker/shiny:4.0.0
|
9 |
|
10 |
+
# Copy installed packages from builder stage
|
11 |
+
COPY --from=builder /usr/local/lib/R/site-library/ /usr/local/lib/R/site-library/
|
12 |
+
|
13 |
+
# Copy installed system packages from builder stage
|
14 |
+
COPY --from=builder /var/lib/apt/lists/ /var/lib/apt/lists/
|
15 |
|
16 |
+
# Set up working directory
|
17 |
WORKDIR /srv/shiny-server/app
|
18 |
|
19 |
# Install additional R packages
|
|
|
26 |
zoo \
|
27 |
dplyr
|
28 |
|
29 |
+
# Arguments
|
30 |
+
ARG UN
|
31 |
+
ARG FILE
|
32 |
+
ARG PAT
|
33 |
+
|
34 |
+
# Create SSH directory
|
35 |
+
RUN mkdir -p /root/.ssh
|
36 |
+
|
37 |
+
# Copy the SSH private key into the container
|
38 |
+
RUN echo "$PAT" > /root/.ssh/id_rsa \
|
39 |
+
&& chmod 600 /root/.ssh/id_rsa \
|
40 |
+
&& ssh-keyscan github.com >> /root/.ssh/known_hosts
|
41 |
+
|
42 |
+
# Clone the repository using SSH
|
43 |
+
RUN git clone git@github.com:${UN}/${FILE}.git /srv/shiny-server/app
|
44 |
+
|
45 |
# Set Auth0 config file path
|
46 |
RUN echo "options(auth0_find_config_file = '/srv/shiny-server/app/_auth0.yml')" > /usr/local/lib/R/etc/Rprofile.site
|
47 |
|