Skip to content

Conversation

@tigattack
Copy link

@tigattack tigattack commented Mar 12, 2025

I've reworked the Docker workflow a little. I started just planning to add a push to GHCR, then the rest happened πŸ˜…

  • Add Docker image labels & annotations β€” This is useful for machine-readability (e.g. dependency management tools and more) and generally a good practice.
  • Add push to GitHub Container Registry (GHCR) β€” This would be super nice to have, especially given that Docker Hub has recently even further decreased their pulls/hr allowance.
  • Add additional image tags (e.g. an image for release v3.0.4 would have tags latest, v3.0.4, 3.0.4, 3.0, 3).
  • Add caching via GitHub Actions cache β€” This should make image builds a lot faster.
  • Some basic refactoring. More could be done to reduce to a single instance of docker/build-push-action, but I didn't want to make this too disruptive.

I ran some simple tests using act to see what the results of the docker/metadata-action would look like for each trigger.

The results look good as far as I'm concerned, however this does break the workflow_dispatch trigger insofar as no tags are generated for such events. As far as I can see this shouldn't be necessary, but I'm not sure specifically how, or even if you were using this trigger before, so let me know if this is a problem for you.

  • schedule:

    {
      "tags": [
        "tigattack/scanservjs:staging",
        "ghcr.io/tigattack/scanservjs:staging"
      ],
      "labels": {
        "org.opencontainers.image.created": "2025-03-12T16:16:54.031Z",
        "org.opencontainers.image.description": "SANE scanner nodejs web ui",
        "org.opencontainers.image.licenses": "GPL-2.0",
        "org.opencontainers.image.revision": "8d0588f6c5886ed3783853d06ece36b834c3d61f",
        "org.opencontainers.image.source": "https://github.com/tigattack/scanservjs",
        "org.opencontainers.image.title": "scanservjs",
        "org.opencontainers.image.url": "https://github.com/tigattack/scanservjs",
        "org.opencontainers.image.version": "staging"
      },
      "annotations": [
        "manifest:org.opencontainers.image.created=2025-03-12T16:16:54.031Z",
        "manifest:org.opencontainers.image.description=SANE scanner nodejs web ui",
        "manifest:org.opencontainers.image.licenses=GPL-2.0",
        "manifest:org.opencontainers.image.revision=8d0588f6c5886ed3783853d06ece36b834c3d61f",
        "manifest:org.opencontainers.image.source=https://github.com/tigattack/scanservjs",
        "manifest:org.opencontainers.image.title=scanservjs",
        "manifest:org.opencontainers.image.url=https://github.com/tigattack/scanservjs",
        "manifest:org.opencontainers.image.version=staging"
      ]
    }
  • release trigger with mocked event data:

    {
      "tags": [
        "tigattack/scanservjs:v3.0.4",
        "tigattack/scanservjs:3.0.4",
        "tigattack/scanservjs:3.0",
        "tigattack/scanservjs:3",
        "tigattack/scanservjs:latest",
        "ghcr.io/tigattack/scanservjs:v3.0.4",
        "ghcr.io/tigattack/scanservjs:3.0.4",
        "ghcr.io/tigattack/scanservjs:3.0",
        "ghcr.io/tigattack/scanservjs:3",
        "ghcr.io/tigattack/scanservjs:latest"
      ],
      "labels": {
        "org.opencontainers.image.created": "2025-03-12T16:16:21.098Z",
        "org.opencontainers.image.description": "SANE scanner nodejs web ui",
        "org.opencontainers.image.licenses": "GPL-2.0",
        "org.opencontainers.image.revision": "8d0588f6c5886ed3783853d06ece36b834c3d61f",
        "org.opencontainers.image.source": "https://github.com/tigattack/scanservjs",
        "org.opencontainers.image.title": "scanservjs",
        "org.opencontainers.image.url": "https://github.com/tigattack/scanservjs",
        "org.opencontainers.image.version": "v3.0.4"
      },
      "annotations": [
        "manifest:org.opencontainers.image.created=2025-03-12T16:16:21.098Z",
        "manifest:org.opencontainers.image.description=SANE scanner nodejs web ui",
        "manifest:org.opencontainers.image.licenses=GPL-2.0",
        "manifest:org.opencontainers.image.revision=8d0588f6c5886ed3783853d06ece36b834c3d61f",
        "manifest:org.opencontainers.image.source=https://github.com/tigattack/scanservjs",
        "manifest:org.opencontainers.image.title=scanservjs",
        "manifest:org.opencontainers.image.url=https://github.com/tigattack/scanservjs",
        "manifest:org.opencontainers.image.version=v3.0.4"
      ]
    }

    The event mock data looked like this:

    {
      "action": "created",
      "release": {
        "tag_name": "v3.0.4"
      }
    }
  • workflow_dispatch:

    {
      "tags": [],
      "labels": {
        "org.opencontainers.image.created": "2025-03-12T16:24:36.661Z",
        "org.opencontainers.image.description": "SANE scanner nodejs web ui",
        "org.opencontainers.image.licenses": "GPL-2.0",
        "org.opencontainers.image.revision": "8d0588f6c5886ed3783853d06ece36b834c3d61f",
        "org.opencontainers.image.source": "https://github.com/tigattack/scanservjs",
        "org.opencontainers.image.title": "scanservjs",
        "org.opencontainers.image.url": "https://github.com/tigattack/scanservjs",
        "org.opencontainers.image.version": ""
      },
      "annotations": [
        "manifest:org.opencontainers.image.created=2025-03-12T16:24:36.661Z",
        "manifest:org.opencontainers.image.description=SANE scanner nodejs web ui",
        "manifest:org.opencontainers.image.licenses=GPL-2.0",
        "manifest:org.opencontainers.image.revision=8d0588f6c5886ed3783853d06ece36b834c3d61f",
        "manifest:org.opencontainers.image.source=https://github.com/tigattack/scanservjs",
        "manifest:org.opencontainers.image.title=scanservjs",
        "manifest:org.opencontainers.image.url=https://github.com/tigattack/scanservjs",
        "manifest:org.opencontainers.image.version="
      ]
    }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant