Open ColinFay opened 2 years ago
Original issue from @antoine-sachet
Bumping this!
Hi, have à look to the add_dockerfile_with_renv function :)
Hi @VincentGuyader,
I updated golem
and dockerfiler
from Github and searched both repos for add_dockerfile_with_renv
and am unable to find the function that you are referring to. Could you elaborate more?
hi yes, we have a little trouble to finalize the transition to golem 0.3.3 which contains the function :)
you can install golem with :
remotes::install_github("thinkr-open/golem@temp_renv")
then run golem::add_dockerfile_with_renv(output_dir = "deploy")
inside your project
Hi @VincentGuyader ,
Thanks for the extra detail! I checked out the branch, it will definitely be nice to have the option of installing from the renv.lock
file as we use renv
on all of our repos. This will dramatically simplify the Dockerfile!
However, while looking through the branch, I didn't notice any support for GITHUB_PAT handling in the case when an app needs to install dependencies from private repos that depend on the GITHUB_PAT as this issue references. Did I miss something?
yes indeed I had misunderstood the request, had passed too quickly on the side "private repos". I have no use case to test on my side.
maybe it's clear for @ColinFay or @statnmap to deal with this need ?
Hi @VincentGuyader,
Ah ok, thanks for clarifying.
For what it's worth, the solution Colin posted above worked for us with a bit of modification.
It requires passing the GITHUB_PAT build arg to each call in the Dockerfile that accesses a private repo.
I might be able to adapt the code above into a sub-function that handles adding the build-args to be used inadd_dockerfile
or add_dockerfile_with_renv
as a Pull Request, if that would be helpful?
yes, PR welcome :)
Context: I manage a shinyproxy server and we use golem for most of our apps. They deploy via an AWS CD pipeline powered by a Dockerfile created with
golem::add_dockerfile()
Problem: docker build can fail when installing packages from github because the rate limit of the GitHub API is exceeded.
For example, this is from my AWS build log:
Solution: Change the command used to install packages from github in the Dockerfile:
should become
This would allow the user to pass a
GITHUB_PAT
when building the docker image and avoid the rate limit. Another HUGE advantage is that it would allow access to private repository!I would suggest adding a logical argument
use_github_pat = FALSE
to the variousadd_dockerfile_XXX()
functions. The default value (FALSE
) would preserve the existing behaviour butuse_github_pat = TRUE
would add the necessary code in the Dockerfile.Note that the user does not need to pass the value of their GITHUB_PAT to add_dockerfile. Instead it must be passed as a build argument when calling
docker build
.