Skip to content

Commit c14e293

Browse files
committed
update Docker workflow re. sandboxing (WIP)
1 parent d45dd27 commit c14e293

File tree

3 files changed

+18
-6
lines changed

3 files changed

+18
-6
lines changed

Dockerfile

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# Dockerfile to render the CODECHECK register, see https://github.com/codecheckers/register
2-
FROM rocker/verse:4.2
2+
FROM rocker/verse:4.5
33

44
RUN apt-get update -qq && apt-get -y --no-install-recommends install \
55
# needed for zen4R's dependency 'keyring'
@@ -16,9 +16,9 @@ WORKDIR /register
1616
ENTRYPOINT [ "R" ]
1717

1818
# set R.cache path to avoid interactive prompt
19-
CMD [ "-e", "options(\"R.cache.rootPath\" = \"/tmp\"); codecheck::register_render(); sessionInfo(); warnings()'" ]
19+
CMD [ "-e", "sessionInfo(); options(\"R.cache.rootPath\" = \"/tmp\"); cat(\"GitHub API usage:\", toString(names(gh::gh_rate_limit())), \" : \", toString(gh::gh_rate_limit()), \"\\n\"); codecheck::register_render(); warnings()'" ]
2020

21-
LABEL maintainer = "Daniel Nüst <daniel.nuest@tu-dresden.de>"
21+
LABEL maintainer="Daniel Nüst <daniel.nuest@tu-dresden.de>"
2222

2323
# Usage, from local copy of the register repository
2424
# docker build --tag codecheckers-register .

Makefile

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,11 +27,16 @@ check_latest: clean
2727

2828
# automated build is active via GitHub Action
2929
image_build:
30-
docker build --tag codecheckers/register:latest --no-cache .
30+
docker build --tag codecheckers/register:latest --no-cache --build-arg GITHUB_PAT=@bash -c "source ~/.Renviron && echo \$\$GITHUB_PAT" .
31+
32+
# use the local GITHUB_PAT to avoid rate limits
33+
image_build_local: $(eval SHELL:=/bin/bash)
34+
source ~/.Renviron && docker build --tag codecheckers/register:latest --no-cache --build-arg GITHUB_PAT=$$GITHUB_PAT .
35+
3136
image_push: image_build
3237
docker push codecheckers/register:latest
3338
.phony: image_build, image_push
3439

35-
image_render:
40+
image_render: $(eval SHELL:=/bin/bash)
3641
docker pull codecheckers/register:latest
37-
docker run --rm -it --user rstudio -v $(shell pwd):/register codecheckers/register:latest
42+
source ~/.Renviron && docker run --rm -it --user rstudio -v $(shell pwd):/register:rw -e GITHUB_PAT=$$GITHUB_PAT codecheckers/register:latest

README.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,13 @@ and clear the cache (in case you made a recent change to an online repo) with `R
7979
To fix problems with hitting the GitHub API rate limit on local register management, go to [your PAT page](https://github.com/settings/tokens) and save a PAT in the environment variable `GITHUB_PAT` to the file `.Renviron` next to this README file.
8080
Alternatively, you may log into your GitHub account locally using the [GitHub CLI (`gh`)](https://cli.github.com/).
8181

82+
To render the register manually in a local **Docker container**, you must mount a local `.Renviron` file with the `GITHUB_PAT` variable to not hit the GitHub API rate limit.
83+
Example (see also `Makefile`):
84+
85+
```bash
86+
docker run --rm -it --user rstudio -v $PWD:/register:rw -v $HOME/.Renviron:/home/rstudio/.Renviron:ro codecheckers/register:latest
87+
```
88+
8289
## Editing of codecheck.yml files
8390

8491
Copilot promts:

0 commit comments

Comments
 (0)