When building a Docker image I need to install an R package that we have in one of our private Bitbucket repos.
While testing, I have been setting the user and pwd as env variables so that I can execute
remotes::install_bitbucket("org/repo"). An example:
FROM rocker/r-ver:4.2.1 ENV BITBUCKET_USER 'me' ENV BITBUCKET_PASSWORD 'mypassword' RUN R -e "install.packages('remotes')" RUN R -e "remotes::install_bitbucket('myorg/myrepo')"
Now I want to push this to Docker Hub, I need a more secure way of providing secrets in the build step.
Based on some research that I've done, I've removed the BITBUCKET_PASSWORD env from the Dockerfile, and am using the following command to try and build the image, but it's not working:
DOCKER_BUILDKIT=1 docker build --secret id=BITBUCKET_PASSWORD,src=path/to/file/test.txt -t test .
I get the error "Failed to install 'unknown package' from Bitbucket".
Do I need to modify the
install_bitbucket function to be something like
install_bitbucket("org/repo", password = BITBUCKET_PASSWORD)? I've tried variations on that as well but they don't work...
Any pointers on what I might be doing wrong are appreciated!