Skip to contents

build and tag lambda image locally

Usage

build_lambda(
  tag,
  runtime_function,
  runtime_path,
  support_path = NULL,
  renvlock_path = NULL,
  dependencies = NULL,
  system_deps = NULL,
  architecture = c("x86_64", "arm64")
)

Arguments

tag

A name for the Docker container and Lambda function

runtime_function

name of the runtime function

runtime_path

path to the script containing the runtime function

support_path

path to the support files (if any). Either NULL (the default) if all needed code is in the same `runtime_path` script, or a character vector of paths to additional files or folders needed by the runtime script. Each is copied next to the runtime script under its own name, so `support_path = "R"` lets the runtime script `source("R/helpers.R")`.

renvlock_path

path to the renv.lock file (if any). Default is NULL.

dependencies

list of dependencies (if any). Default is NULL.

system_deps

character vector of Amazon Linux 2023 packages to install with `dnf` before the R packages, for R packages that need system libraries, e.g. `"udunits2"` for `units`. Amazon Linux 2023 has no EPEL, so some libraries, such as GDAL, are not available. Default is NULL.

architecture

CPU architecture of the Lambda function, `"x86_64"` (default) or `"arm64"`. `deploy_lambda` reads it from the image. Building an arm64 image on an x86_64 machine, or the reverse, needs Docker's QEMU emulation.

Value

None, called for its side effect of building a local Docker image.

Details

Use either `renvlock_path` or `dependencies` to install required packages, not both. By default, both are `NULL`, so the Docker image will have no additional packages installed.

Examples

if (FALSE) { # \dontrun{
  build_lambda(
    tag = "parity1",
    runtime_function = "parity",
    runtime_path = system.file("parity.R", package = "r2lambda")
  )
} # }