-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
51 lines (32 loc) · 1.31 KB
/
Dockerfile
File metadata and controls
51 lines (32 loc) · 1.31 KB
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
# We use multi-stage build contexts to generate different versions of the image from one dockerfile
# base: the complete software system is installed, non executable
# app: executable app
#
# See https://medium.com/@tonistiigi/advanced-multi-stage-build-patterns-6f741b852fae
#
# Note that ARG for image name needs to come before any FROM so it can be used in a FROM at the end
#
# See https://docs.docker.com/engine/reference/builder/#understand-how-arg-and-from-interact
#
ARG image_name "base"
# built upon the rocker/tidyverse image, which includes remotes and shiny
FROM rocker/tidyverse:latest AS tidyverse
# set env vars
ARG SHINY_ACCOUNT ""
ARG SHINY_TOKEN ""
ARG SHINY_SECRET ""
ENV SHINY_ACCOUNT=""
ENV SHINY_TOKEN=""
ENV SHINY_SECRET=""
# Build args, default to the base image from the main branch
ARG event_sha "HEAD"
# Install ShinyDocker from github event that is triggering the build
RUN echo "Installing ShinyDocker from github at ref $event_sha"
RUN R -e "remotes::install_github('dapperstats/ShinyDocker', ref = '$event_sha')"
# Each image branches for specific run code
FROM tidyverse AS base-branch
FROM tidyverse AS app-branch
RUN R -e "library(ShinyDocker); setup_dir( )"
CMD ["R", "-e", "library(ShinyDocker); deploy_app( )"]
# Bring the branches together
FROM ${image_name}-branch AS final