Container image¶
la-gram-git's container image holds the npm package, installed globally, with Node.js and Git. A CI job
that uses it as its image runs la-gram-git with nothing to download; on a desktop, it runs la-gram-git
without installing Node.js.
$ docker run --rm -v "$PWD/packages/la-gram-git/smoke:/repo" la-gram-git:docs-example la-gram-git check
✓ shop.ttl
· 1 warning, 0 info
· 5 from the shapes' SPARQL-based rules (advisory):
· warning: Billing (Application Component) · Application component Billing directly serves another application component Portal without an intermediary service. (https://meta.linked.archi/archimate4/principle-shapes#DirectComponentToComponentServingShape)
…
1 model file checked: all well.
The examples on this page ran an image built from a checkout as la-gram-git:docs-example; with the
published image, name ghcr.io/linked-archi/la-gram-git:0 instead (Tags).
Mount the repository at /repo, the image's working folder, and name the command:
docker run --rm -v "$PWD:/repo" <image> la-gram-git check. Commands that read history
(check --base, diff) need the repository's .git in the mount, which mounting its top folder gives.
Contents¶
- Node.js, from the base image (22, by default).
- Git and
ca-certificates, from Debian:check --base,diff,mergeandinitcall Git, anddiff --commentcalls the Git host's API over HTTPS. git config --system --add safe.directory '*': a repository mounted into the container belongs to the host's user, not the container's, and Git refuses to read a repository another user owns. The image runs nothing but la-gram-git, so it trusts the one it is given.- la-gram-git, installed globally with
npm install --globalfrom the packed.tgz, so the image holds exactly what npm publishes. WORKDIR /repo, empty.- No
ENTRYPOINTof its own. A CI job runs its script in the image's shell, which an entrypoint would replace; the base image'sdocker-entrypoint.shruns whatever command is given. Name the tool:la-gram-git check. CMD ["la-gram-git", "--help"]: run with no command, the image prints the usage.
$ docker run --rm la-gram-git:docs-example la-gram-git --version
0.1.0
$ docker run --rm la-gram-git:docs-example sh -c 'node --version; git --version; git config --system --get-all safe.directory; ls /repo | wc -l'
v22.23.4
git version 2.39.5
*
0
$ docker run --rm la-gram-git:docs-example
la-gram-git — la-gram's models in Git: checked, rewritten, compared, merged.
…
$ docker image inspect --format '{{json .Config.WorkingDir}} {{json .Config.Cmd}} {{json .Config.Entrypoint}}' la-gram-git:docs-example
"/repo" ["la-gram-git","--help"] ["docker-entrypoint.sh"]
A model can also go in on the standard input, where a job's files cannot be mounted:
$ docker run --rm -i la-gram-git:docs-example sh -c 'cat > /repo/shop.ttl && la-gram-git check' < packages/la-gram-git/smoke/shop.ttl
✓ shop.ttl
…
1 model file checked: all well.
Tags¶
Each la-gram-git release publishes the image to GitHub's container registry, as
ghcr.io/linked-archi/la-gram-git:
| Tag | For release 0.1.1 |
For a pre-release 0.2.0-rc.1 |
|---|---|---|
| the version | :0.1.1 |
:0.2.0-rc.1 |
| the major version | :0 |
— |
latest |
:latest |
— |
| per platform | :0.1.1-amd64, :0.1.1-arm64 |
:0.2.0-rc.1-amd64, :0.2.0-rc.1-arm64 |
The version, major and latest tags each cover linux/amd64 and linux/arm64, so x86 and Arm runners
take the image for their platform; each is tried on its own platform before it is tagged. The CI templates'
variations use :0 (la-gram-git in CI). The first image is 0.1.1's: 0.1.0 is on
npm only.
To copy the published image into your own registry, pull its tag and push it under your name, or copy
the multi-platform list with docker buildx imagetools create --tag <your-registry>/la-gram-git:0
ghcr.io/linked-archi/la-gram-git:0.
To build the image yourself — from a la-gram checkout, with its build arguments — see Developing la-gram.