Skip to content

plumb_api creates a separate nested environment with no dependencies avaiable #996

Description

@avhz

I have bundled a Plumber API in a package, and I am trying to deploy it in a docker container but have the following issue.

I run in the docker command Rscript api.R, with api.R containing:

renv::install(c("my_package", "crew", "plumber"), dependencies = TRUE, prompt = FALSE)

plumber::plumb_api("my_package", "api") |> 
    plumber::pr_set_debug(TRUE) |>
    plumber::pr_run(host = "0.0.0.0", port = 8000)

This installs my_package which contains my api bundled in inst/plumber/api/plumber.R (as documented here), along with some dependencies (crew and plumber).

I get a renv environment in the top level directory containing my_package, but plumber starts the app deep within the renv directory under:

renv/.../my_package/0.1.8/dd33f32a5a208139aec9e243fb8dfa04/my_package/plumber/api

But in this environment none of my dependencies are available anymore.

What is the solution to this problem ?

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions