R/add_dockerfiles.R
, R/add_dockerfiles_renv.R
dockerfiles.Rd
Build a container containing your Shiny App. add_dockerfile()
and
add_dockerfile_with_renv()
and add_dockerfile_with_renv()
creates
a generic Dockerfile, while add_dockerfile_shinyproxy()
,
add_dockerfile_with_renv_shinyproxy()
, add_dockerfile_with_renv_shinyproxy()
and
add_dockerfile_heroku()
creates platform specific Dockerfile.
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 = ".",
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,
extra_sysreqs = NULL,
update_tar_gz = TRUE,
dockerfile_cmd = NULL
)
add_dockerfile_with_renv_shinyproxy(
source_folder = ".",
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,
update_tar_gz = TRUE
)
add_dockerfile_with_renv_heroku(
source_folder = ".",
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,
update_tar_gz = TRUE
)
path to the DESCRIPTION file to use as an input.
name of the Dockerfile output.
Path to the root of the package. Default is get_golem_wd()
.
The FROM of the Dockerfile. Default is
The AS of the Dockerfile. Default it NULL.
The options('shiny.port')
on which to run the App.
Default is 80.
The options('shiny.host')
on which to run the App.
Default is 0.0.0.0.
boolean. If TRUE, RUN statements to install packages system requirements will be included in the Dockerfile.
character. The URL(s) of the repositories to use for options("repos")
.
boolean. If TRUE
each system requirement will have its own RUN
line.
boolean. Should the Dockerfile/README/README be open after creation? Default is TRUE
.
boolean. If TRUE
and build_golem_from_source
is also TRUE
,
an updated tar.gz is created.
boolean. If TRUE
no tar.gz is created and
the Dockerfile directly mount the source folder.
character vector. Extra debian system requirements.
path to the Package/golem source folder to deploy. default is current folder '.'
path to the renv.lock file to use. default is NULL
folder to export everything deployment related.
One of "focal", "bionic", "xenial", "centos7", or "centos8". See available distributions at https://hub.docker.com/r/rstudio/r-base/.
What is the CMD to add to the Dockerfile. If NULL, the default,
the CMD will be R -e "options('shiny.port'={port},shiny.host='{host}');{appname}::run_app()\
The {dockerfiler}
object, invisibly.
# \donttest{
# Add a standard Dockerfile
if (interactive() & requireNamespace("dockerfiler")) {
add_dockerfile()
}
#> Loading required namespace: dockerfiler
# 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()
}
# }