9.2 just docker-shell and just docker-test

Read the tutorial. Build it yourself is the other way to read this part.

This walk goes through rahuldave/cheesecracker on GitHub. This part starts from the code at ccf62d330f28, partway through step-09. The code before this part

To look at this code on your machine, run these commands. The first one makes a clone, if this folder has none:

[ -d cheesecracker ] || git clone https://github.com/rahuldave/cheesecracker
cd cheesecracker
git fetch --quiet --tags --force origin
git switch --detach ccf62d330f28
just setup
just docker-build dev

The whole tutorial then adds the dev image to the Dockerfile. Two recipes run it, with the folder of the project mounted inside.

9.2 just docker-shell and just docker-test

Two recipes run the dev image with this folder mounted at /work. An edit here shows in there at once, so the image needs no rebuild after a change of the code. docker-shell opens a shell in the image. docker-test runs the recipe that you name in the image, or just check if you name none.

± See the change to justfile

docker-shell runs docker run --rm -it -v "$PWD":/work cheesecracker-dev. -v mounts this folder at /work, and -it gives the shell a terminal. docker-test runs just in the image, with its words, or with check.

just docker-test

just check runs in Linux. The last line is 21 passed. The system tests do not run, because just check leaves them out.

just docker-test test tests/unit -q

The eleven unit tests pass in Linux.

What changed

  • justfile: the recipes docker-shell and docker-test. 8 lines added. The file
    • look at docker run --rm -v "$PWD":/work cheesecracker-dev just "${@:-check}"

The diff of justfile
@@ -86,3 +86,11 @@ docker-stop:
 # Run the system tests against the server at http://localhost:9000. They fail when no server answers there
 test-system *args:
     uv run pytest tests/system "$@"
+
+# A shell in the dev image, with this folder mounted at /work: an edit here shows in there at once
+docker-shell:
+    docker run --rm -it -v "$PWD":/work cheesecracker-dev
+
+# Run a recipe in the dev image, with this folder mounted at /work. Alone, just check: just docker-test test tests/unit
+docker-test *args:
+    docker run --rm -v "$PWD":/work cheesecracker-dev just "${@:-check}"

This change on GitHub

This part ends at the code at step-09. The code after this part