-
Notifications
You must be signed in to change notification settings - Fork 131
/
Copy pathdockerfiles.Rd
218 lines (188 loc) · 6.56 KB
/
dockerfiles.Rd
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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/add_dockerfiles.R, R/add_dockerfiles_renv.R
\name{add_dockerfile}
\alias{add_dockerfile}
\alias{add_dockerfile_shinyproxy}
\alias{add_dockerfile_heroku}
\alias{add_dockerfile_with_renv}
\alias{add_dockerfile_with_renv_shinyproxy}
\alias{add_dockerfile_with_renv_heroku}
\title{Create a Dockerfile for your App}
\usage{
add_dockerfile(
path = "DESCRIPTION",
output = "Dockerfile",
pkg = get_golem_wd(),
from = paste0("rocker/verse:", R.Version()$major, ".", R.Version()$minor),
as = NULL,
port = 80,
host = "0.0.0.0",
sysreqs = TRUE,
repos = c(CRAN = "https://cran.rstudio.com/"),
expand = FALSE,
open = TRUE,
update_tar_gz = TRUE,
build_golem_from_source = TRUE,
extra_sysreqs = NULL
)
add_dockerfile_shinyproxy(
path = "DESCRIPTION",
output = "Dockerfile",
pkg = get_golem_wd(),
from = paste0("rocker/verse:", R.Version()$major, ".", R.Version()$minor),
as = NULL,
sysreqs = TRUE,
repos = c(CRAN = "https://cran.rstudio.com/"),
expand = FALSE,
open = TRUE,
update_tar_gz = TRUE,
build_golem_from_source = TRUE,
extra_sysreqs = NULL
)
add_dockerfile_heroku(
path = "DESCRIPTION",
output = "Dockerfile",
pkg = get_golem_wd(),
from = paste0("rocker/verse:", R.Version()$major, ".", R.Version()$minor),
as = NULL,
sysreqs = TRUE,
repos = c(CRAN = "https://cran.rstudio.com/"),
expand = FALSE,
open = TRUE,
update_tar_gz = TRUE,
build_golem_from_source = TRUE,
extra_sysreqs = NULL
)
add_dockerfile_with_renv(
source_folder = get_golem_wd(),
lockfile = NULL,
output_dir = fs::path(tempdir(), "deploy"),
distro = "focal",
from = "rocker/verse",
as = NULL,
sysreqs = TRUE,
port = 80,
host = "0.0.0.0",
repos = c(CRAN = "https://cran.rstudio.com/"),
expand = FALSE,
open = TRUE,
document = TRUE,
extra_sysreqs = NULL,
update_tar_gz = TRUE,
dockerfile_cmd = NULL,
user = "rstudio",
...
)
add_dockerfile_with_renv_shinyproxy(
source_folder = get_golem_wd(),
lockfile = NULL,
output_dir = fs::path(tempdir(), "deploy"),
distro = "focal",
from = "rocker/verse",
as = NULL,
sysreqs = TRUE,
repos = c(CRAN = "https://cran.rstudio.com/"),
expand = FALSE,
extra_sysreqs = NULL,
open = TRUE,
document = TRUE,
update_tar_gz = TRUE,
user = "rstudio",
...
)
add_dockerfile_with_renv_heroku(
source_folder = get_golem_wd(),
lockfile = NULL,
output_dir = fs::path(tempdir(), "deploy"),
distro = "focal",
from = "rocker/verse",
as = NULL,
sysreqs = TRUE,
repos = c(CRAN = "https://cran.rstudio.com/"),
expand = FALSE,
extra_sysreqs = NULL,
open = TRUE,
document = TRUE,
user = "rstudio",
update_tar_gz = TRUE,
...
)
}
\arguments{
\item{path}{path to the DESCRIPTION file to use as an input.}
\item{output}{name of the Dockerfile output.}
\item{pkg}{Path to the root of the package. Default is \code{get_golem_wd()}.}
\item{from}{The FROM of the Dockerfile. Default is
\if{html}{\out{<div class="sourceCode">}}\preformatted{FROM rocker/verse
without renv.lock file passed
`R.Version()$major`.`R.Version()$minor` is used as tag
}\if{html}{\out{</div>}}}
\item{as}{The AS of the Dockerfile. Default it NULL.}
\item{port}{The \code{options('shiny.port')} on which to run the App.
Default is 80.}
\item{host}{The \code{options('shiny.host')} on which to run the App.
Default is 0.0.0.0.}
\item{sysreqs}{boolean. If TRUE, RUN statements to install packages
system requirements will be included in the Dockerfile.}
\item{repos}{character. The URL(s) of the repositories to use for \code{options("repos")}.}
\item{expand}{boolean. If \code{TRUE} each system requirement will have its own \code{RUN} line.}
\item{open}{boolean. Should the Dockerfile/README/README be open after creation? Default is \code{TRUE}.}
\item{update_tar_gz}{boolean. If \code{TRUE} and \code{build_golem_from_source} is also \code{TRUE},
an updated tar.gz is created.}
\item{build_golem_from_source}{boolean. If \code{TRUE} no tar.gz is created and
the Dockerfile directly mount the source folder.}
\item{extra_sysreqs}{character vector. Extra debian system requirements.}
\item{source_folder}{path to the Package/golem source folder to deploy.
default is retrieved via \code{\link[=get_golem_wd]{get_golem_wd()}}.}
\item{lockfile}{path to the renv.lock file to use. default is \code{NULL}.}
\item{output_dir}{folder to export everything deployment related.}
\item{distro}{One of "focal", "bionic", "xenial", "centos7", or "centos8".
See available distributions at https://hub.docker.com/r/rstudio/r-base/.}
\item{document}{boolean. If TRUE (by default), DESCRIPTION file is updated using \code{\link[attachment:att_amend_desc]{attachment::att_amend_desc()}} before creating the renv.lock file}
\item{dockerfile_cmd}{What is the CMD to add to the Dockerfile. If NULL, the default,
the CMD will be \verb{R -e "options('shiny.port'=\{port\},shiny.host='\{host\}');library(\{appname\});\{appname\}::run_app()\\}.}
\item{user}{Name of the user to specify in the Dockerfile with the USER instruction. Default is \code{rstudio}, if set to \code{NULL} no the user from the FROM image is used.}
\item{...}{Other arguments to pass to \code{\link[renv:snapshot]{renv::snapshot()}}.}
}
\value{
The \code{{dockerfiler}} object, invisibly.
}
\description{
Build a container containing your Shiny App. \code{add_dockerfile()} and
\code{add_dockerfile_with_renv()} and \code{add_dockerfile_with_renv()} creates
a generic Dockerfile, while \code{add_dockerfile_shinyproxy()},
\code{add_dockerfile_with_renv_shinyproxy()} , \code{add_dockerfile_with_renv_shinyproxy()} and
\code{add_dockerfile_heroku()} creates platform specific Dockerfile.
}
\examples{
\donttest{
# Add a standard Dockerfile
if (interactive() & requireNamespace("dockerfiler")) {
add_dockerfile()
}
# Crete a 'deploy' folder containing everything needed to deploy
# the golem using docker based on {renv}
if (interactive() & requireNamespace("dockerfiler")) {
add_dockerfile_with_renv(
# lockfile = "renv.lock", # uncomment to use existing renv.lock file
output_dir = "deploy"
)
}
# Add a Dockerfile for ShinyProxy
if (interactive() & requireNamespace("dockerfiler")) {
add_dockerfile_shinyproxy()
}
# Crete a 'deploy' folder containing everything needed to deploy
# the golem with ShinyProxy using docker based on {renv}
if (interactive() & requireNamespace("dockerfiler")) {
add_dockerfile_with_renv(
# lockfile = "renv.lock",# uncomment to use existing renv.lock file
output_dir = "deploy"
)
}
# Add a Dockerfile for Heroku
if (interactive() & requireNamespace("dockerfiler")) {
add_dockerfile_heroku()
}
}
}