README.org: Add section about local image usage; cleanup

This commit is contained in:
Collin J. Doering 2024-01-04 21:59:33 -05:00
parent 2bc5f9229c
commit 6fc9d2ebff
Signed by: rekahsoft
GPG Key ID: 7B4DEB93212B3022
1 changed files with 18 additions and 22 deletions

View File

@ -46,6 +46,21 @@ Alternatively, ~./shell.sh~ can be invoked directly
~build~ is optional, as its the default target.
* Testing and using the image locally
The easiest way to use and test the guix-builder container image is to use the provide make
target.
#+begin_src shell
make run
#+end_src
Or, if you want to run in a container with no guix store mounted.
#+begin_src shell
make run-no-store
#+end_src
* Using the image
Now that the OCI image has been produced, some care must be taken when running it. Namely,
@ -73,14 +88,13 @@ not required.
docker run --rm -it \
-v /var/guix/daemon-socket/socket:/var/guix/daemon-socket/socket \
-v /gnu/store:/gnu/store:ro \
-v /etc/ssl:/etc/ssl:ro \
-v /var/lib/ci/guix-cache:/tmp/.cache/guix \
-e HOME=/tmp \
-w /tmp \
guix-builder:latest
#+end_src
** Using the image with DroneCI / WoodpeckerCI
** Using the image with Gitea/Forgejo actions or DroneCI/WoodpeckerCI
The primary use-case for the image produced by this repository is for ci/cd jobs (mandatorily
on a host that is running guix-daemon itself). This allows for the hosts guix store to be
@ -90,29 +104,11 @@ times.
Any ci/cd tool that can run OCI containers should be compatible with this image, though the
optimal setup assumes it provides a mechanism to mount volumes and set environment variables
(by an administrator). Both DroneCI and WoodpeckerCI allow for this, using
~DRONE_RUNNER_VOLUMES~ and ~WOODPECKER_BACKEND_DOCKER_VOLUMES~ respectively.
~DRONE_RUNNER_VOLUMES~ and ~WOODPECKER_BACKEND_DOCKER_VOLUMES~ respectively. Gitea/Forgejo
actions allow it via the ~container.options~ configuration value.
Note, in WoodpeckerCI, this functionality has not yet made it into a release (see [[https://github.com/woodpecker-ci/woodpecker/pull/1203][PR]]).
Below is an example of running ~drone-runner-docker~, setup to spawn ~guix~ images produced
by this repository:
#+begin_src shell
docker run -d \
-v /var/run/docker.sock:/var/run/docker.sock \
-e DRONE_RPC_PROTO="https" \
-e DRONE_RPC_HOST="<REDACTED>" \
-e DRONE_RPC_SECRET="<REDACTED>" \
-e DRONE_RUNNER_CAPACITY=4 \
-e DRONE_RUNNER_NAME="<REDACTED>" \
-e DRONE_RUNNER_LABELS=guix:on \
-e DRONE_RUNNER_VOLUMES=/var/guix/daemon-socket/socket:/var/guix/daemon-socket/socket,/gnu/store:/gnu/store,/var/lib/ci/guix-cache:/.cache/guix \
-p 3001:3000 \
--restart unless-stopped \
--name runner-guix \
drone/drone-runner-docker:1.6.3
#+end_src
* FAQ
** Why not produce this image with ~guix pack -f docker ...~ directly?