build_image {pracpac} | R Documentation |
Build a Docker image
Description
Builds a Docker image created by use_docker or add_dockerfile. This function is run as part of use_docker when build = TRUE
is set, but can be used on its own.
Usage
build_image(
pkg_path = ".",
img_path = NULL,
cache = TRUE,
tag = NULL,
build = TRUE
)
Arguments
pkg_path |
Path to the package directory. Default is |
img_path |
Path to the write the docker image definition contents. The default |
cache |
Logical; should caching be used? Default |
tag |
Image tag to use; default is |
build |
Logical as to whether or not the image should be built. Default is |
Value
Invisibly returns the docker build
command. Primarily called for its side effects, which runs the docker build
as a system command.
Examples
## Not run:
# Specify path to example package source and copy to tempdir()
# Note that in practice you do not need to copy to a tempdir()
# And in fact it may be easiest to use pracpac relative to your package directory root
ex_pkg_src <- system.file("hellow", package = "pracpac", mustWork = TRUE)
file.copy(from = ex_pkg_src, to = tempdir(), recursive = TRUE)
# Run use_docker to create Docker directory and assets for the example package
use_docker(pkg_path = file.path(tempdir(), "hellow"))
# Build the image
build_image(pkg_path = file.path(tempdir(), "hellow"))
# Or construct the image build command without building
build_cmd <- build_image(pkg_path = file.path(tempdir(), "hellow"), build=FALSE)
build_cmd
## End(Not run)