Adds a FROM instruction to specify the base image for the Docker build.
This is typically the first instruction in a Dockerfile.
Details
The FROM instruction initializes a new build stage and sets the base image.
The metadata for the dockerfile object (package manager, OS, and R version)
is automatically updated based on the base image.
See also
dockerfile() for creating a dockerfile object,
dfi_run() for adding commands to run in the container, &
Official Docker FROM documentation
Other dockerfile instruction functions:
dfi_add(),
dfi_arg(),
dfi_cmd(),
dfi_copy(),
dfi_entrypoint(),
dfi_env(),
dfi_expose(),
dfi_healthcheck(),
dfi_label(),
dfi_maintainer(),
dfi_onbuild(),
dfi_run(),
dfi_shell(),
dfi_stopsignal(),
dfi_user(),
dfi_volume(),
dfi_workdir()
Examples
# Use a specific R version
df <- dockerfile() |>
dfi_from("rocker/r-ver:4.4.0")
df
#> FROM rocker/r-ver:4.4.0
# Use a multi-stage build
df <- dockerfile() |>
dfi_from("rocker/r-ver:4.4.0", as = "build")
df
#> FROM rocker/r-ver:4.4.0 AS build