Skip to contents

This function takes a directory containing a Shiny application (either R or Python) and exports it to an appropriate Docker container. It handles the entire process including creating Docker configuration, building the Docker image, and optionally running the container.

Usage

export(
  app_dir,
  output_dir = NULL,
  tag = NULL,
  port = 3838,
  env_vars = NULL,
  run = FALSE,
  detach = TRUE,
  quiet = FALSE,
  ...
)

Arguments

app_dir

Character. Path to the Shiny application directory.

output_dir

Character. Path where Docker configuration should be created. If NULL, files will be created in app_dir.

tag

Character. The tag for the Docker image. If NULL, a tag will be generated from the directory name.

port

Integer. The port to expose for the Shiny application. Default: 3838.

env_vars

Named character vector. Environment variables to include in the Docker configuration.

run

Logical. Whether to run the container after building. Default: FALSE.

detach

Logical. If run=TRUE, whether to run in detached mode. Default: TRUE.

quiet

Logical. If TRUE, suppress Docker command output. Default: FALSE.

...

Additional arguments passed to underlying functions.

Value

Invisibly returns a list with the paths to the created Docker files and container information if run=TRUE.

Examples

if (FALSE) { # \dontrun{
# Basic usage
export("path/to/my/shinyapp")

# Export and run
export("path/to/my/shinyapp", run = TRUE)

# Custom configuration
export("path/to/my/shinyapp", 
       tag = "myorg/myapp:latest",
       port = 8080,
       env_vars = c(API_KEY = "secret-key"),
       run = TRUE)
} # }