Skip to content

Commit

Permalink
build: Add org.opencontainers labels to Docker image
Browse files Browse the repository at this point in the history
  • Loading branch information
bow committed Jul 23, 2024
1 parent 051cb56 commit 6ffafec
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
3 changes: 3 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,9 @@ jobs:
if: github.ref_type == 'tag' && github.ref_name != ''
run: nix develop --command poetry dynamic-versioning

- name: Capture current commit hash
run: printf "${{ github.sha }}" > .rev && git add .rev

- name: Build and push image to registry
run: >
nix build .#dockerArchiveStreamer
Expand Down
13 changes: 12 additions & 1 deletion flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,18 @@
name = "ghcr.io/bow/${app.pname}";
tag = imgTag;
contents = [ app ];
config.Entrypoint = [ "/bin/${app.pname}" ];
config = {
Entrypoint = [ "/bin/${app.pname}" ];
Labels = {
"org.opencontainers.image.title" = "${app.pname}";
"org.opencontainers.image.revision" =
with builtins;
let
revFile = "${self}/.rev";
in
if pathExists revFile then (readFile revFile) else "";
};
};
};
in
{
Expand Down

0 comments on commit 6ffafec

Please sign in to comment.