From ed96144172c9d7c469972f2c10b5968cc22d14ab Mon Sep 17 00:00:00 2001 From: Patrick Hoefler Date: Fri, 27 Mar 2026 18:23:26 +0100 Subject: [PATCH 1/6] chore: migrate GoReleaser config from deprecated keys - Replace `dockers` with `dockers_v2` for multi-arch builds - Replace `brews` with `homebrew_casks` - Update Dockerfile to use ARG TARGETPLATFORM for multi-arch support - Add VS Code workspace file Co-Authored-By: Claude Sonnet 4.6 --- .goreleaser.yaml | 32 ++++++++++++++++++-------------- Dockerfile | 6 +++--- homebrew.code-workspace | 10 ++++++++++ 3 files changed, 31 insertions(+), 17 deletions(-) create mode 100644 homebrew.code-workspace diff --git a/.goreleaser.yaml b/.goreleaser.yaml index 54f6454..9c1b71b 100644 --- a/.goreleaser.yaml +++ b/.goreleaser.yaml @@ -16,21 +16,25 @@ builds: changelog: disable: true -dockers: - - dockerfile: Dockerfile - image_templates: - - 'ghcr.io/patrickhoefler/dockerfilegraph:latest' - - 'ghcr.io/patrickhoefler/dockerfilegraph:{{ .Major }}' - - 'ghcr.io/patrickhoefler/dockerfilegraph:{{ .Major }}.{{ .Minor }}' - - 'ghcr.io/patrickhoefler/dockerfilegraph:{{ .Major }}.{{ .Minor }}.{{ .Patch }}' +dockers_v2: + - images: + - 'ghcr.io/patrickhoefler/dockerfilegraph' + tags: + - 'latest' + - '{{ .Major }}' + - '{{ .Major }}.{{ .Minor }}' + - '{{ .Major }}.{{ .Minor }}.{{ .Patch }}' # for backwards compatibility - - 'ghcr.io/patrickhoefler/dockerfilegraph:alpine' - - 'ghcr.io/patrickhoefler/dockerfilegraph:latest-alpine' - - 'ghcr.io/patrickhoefler/dockerfilegraph:{{ .Major }}-alpine' - - 'ghcr.io/patrickhoefler/dockerfilegraph:{{ .Major }}.{{ .Minor }}-alpine' - - 'ghcr.io/patrickhoefler/dockerfilegraph:{{ .Major }}.{{ .Minor }}.{{ .Patch }}-alpine' + - 'alpine' + - 'latest-alpine' + - '{{ .Major }}-alpine' + - '{{ .Major }}.{{ .Minor }}-alpine' + - '{{ .Major }}.{{ .Minor }}.{{ .Patch }}-alpine' + platforms: + - linux/amd64 + - linux/arm64 -brews: +homebrew_casks: - repository: owner: patrickhoefler name: homebrew-tap @@ -38,4 +42,4 @@ brews: homepage: https://github.com/patrickhoefler/dockerfilegraph description: 'Visualize your multi-stage Dockerfile' dependencies: - - graphviz + - formula: graphviz diff --git a/Dockerfile b/Dockerfile index 3095dde..8f8e226 100644 --- a/Dockerfile +++ b/Dockerfile @@ -19,8 +19,8 @@ RUN apk add --update --no-cache \ # Run as non-root user USER app -# This only works after running `task build-linux` -# or when using goreleaser -COPY dockerfilegraph / +# This only works when using goreleaser (multi-arch via TARGETPLATFORM) +ARG TARGETPLATFORM +COPY $TARGETPLATFORM/dockerfilegraph / ENTRYPOINT ["/dockerfilegraph"] diff --git a/homebrew.code-workspace b/homebrew.code-workspace new file mode 100644 index 0000000..d484f99 --- /dev/null +++ b/homebrew.code-workspace @@ -0,0 +1,10 @@ +{ + "folders": [ + { + "path": "." + }, + { + "path": "../homebrew-tap" + } + ] +} From 18f4cf44b7a89617184e0cc6b3d3d43b4357b879 Mon Sep 17 00:00:00 2001 From: Patrick Hoefler Date: Fri, 27 Mar 2026 18:26:39 +0100 Subject: [PATCH 2/6] fix: default TARGETPLATFORM to . for local Docker builds Without a default, the integration test's docker build fails because the binary is at the project root, not linux/amd64/dockerfilegraph. GoReleaser sets TARGETPLATFORM explicitly; local builds now fall back to . Co-Authored-By: Claude Sonnet 4.6 --- Dockerfile | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/Dockerfile b/Dockerfile index 8f8e226..063a73e 100644 --- a/Dockerfile +++ b/Dockerfile @@ -19,8 +19,9 @@ RUN apk add --update --no-cache \ # Run as non-root user USER app -# This only works when using goreleaser (multi-arch via TARGETPLATFORM) -ARG TARGETPLATFORM +# When using goreleaser, TARGETPLATFORM is set to e.g. linux/amd64. +# For local builds, it defaults to . (binary at the project root). +ARG TARGETPLATFORM=. COPY $TARGETPLATFORM/dockerfilegraph / ENTRYPOINT ["/dockerfilegraph"] From 8493da911e0050207c64751f8fade0225d780b83 Mon Sep 17 00:00:00 2001 From: Patrick Hoefler Date: Fri, 27 Mar 2026 18:35:51 +0100 Subject: [PATCH 3/6] fix: add buildx/QEMU setup for dockers_v2 multi-arch builds dockers_v2 requires a proper buildx builder (docker-container driver) for multi-platform builds. The default docker driver doesn't set TARGETPLATFORM, causing builds to fail. Also update CI smoke tests to dynamically find the snapshot image tag, since dockers_v2 in snapshot mode produces per-platform tags instead of the plain `latest` tag. Co-Authored-By: Claude Opus 4.6 --- .github/workflows/lint-and-test.yml | 16 ++++++++++++++-- .github/workflows/release.yml | 6 ++++++ 2 files changed, 20 insertions(+), 2 deletions(-) diff --git a/.github/workflows/lint-and-test.yml b/.github/workflows/lint-and-test.yml index daa16ba..21a2e79 100644 --- a/.github/workflows/lint-and-test.yml +++ b/.github/workflows/lint-and-test.yml @@ -102,17 +102,29 @@ jobs: with: go-version-file: '.go-version' + - name: Set up QEMU + uses: docker/setup-qemu-action@ce360397dd3f832beb865e1373c09c0e9f86d70a # v4.0.0 + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@4d04d5d9486b7bd6fa91e7baf45bbb4f8b9deedd # v4.0.0 + - name: Build binaries and Docker image with GoReleaser uses: goreleaser/goreleaser-action@ec59f474b9834571250b370d4735c50f8e2d1e29 # v7.0.0 with: version: '~> v2' args: release --snapshot + - name: Find snapshot image + id: find-image + run: | + IMAGE=$(docker images 'ghcr.io/patrickhoefler/dockerfilegraph' --format '{{.Repository}}:{{.Tag}}' | head -1) + echo "image=$IMAGE" >> "$GITHUB_OUTPUT" + # Smoke tests - name: Get the version run: | docker run \ - ghcr.io/patrickhoefler/dockerfilegraph:latest \ + ${{ steps.find-image.outputs.image }} \ --version - name: Run the Docker image with flags @@ -122,7 +134,7 @@ jobs: --user "$(id -u):$(id -g)" \ --workdir /workspace \ --volume "$(pwd)":/workspace \ - ghcr.io/patrickhoefler/dockerfilegraph:latest \ + ${{ steps.find-image.outputs.image }} \ --legend \ --output png \ --dpi 200 diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index ae9eaeb..b5d6c42 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -38,6 +38,12 @@ jobs: with: go-version-file: '.go-version' + - name: Set up QEMU + uses: docker/setup-qemu-action@ce360397dd3f832beb865e1373c09c0e9f86d70a # v4.0.0 + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@4d04d5d9486b7bd6fa91e7baf45bbb4f8b9deedd # v4.0.0 + - name: Login to GitHub Container Registry uses: docker/login-action@b45d80f862d83dbcd57f89517bcf500b2ab88fb2 # v4.0.0 with: From 51326620d3a0cd46d6fb09834a2820be41dd52e5 Mon Sep 17 00:00:00 2001 From: Patrick Hoefler Date: Fri, 27 Mar 2026 22:12:08 +0100 Subject: [PATCH 4/6] revert: undo dockers_v2 migration, keep homebrew_casks only dockers_v2 requires more careful Dockerfile changes. Reverting to the original dockers config while keeping the brews -> homebrew_casks migration. Co-Authored-By: Claude Sonnet 4.6 --- .github/workflows/lint-and-test.yml | 16 ++-------------- .github/workflows/release.yml | 6 ------ .goreleaser.yaml | 28 ++++++++++++---------------- Dockerfile | 7 +++---- 4 files changed, 17 insertions(+), 40 deletions(-) diff --git a/.github/workflows/lint-and-test.yml b/.github/workflows/lint-and-test.yml index 21a2e79..daa16ba 100644 --- a/.github/workflows/lint-and-test.yml +++ b/.github/workflows/lint-and-test.yml @@ -102,29 +102,17 @@ jobs: with: go-version-file: '.go-version' - - name: Set up QEMU - uses: docker/setup-qemu-action@ce360397dd3f832beb865e1373c09c0e9f86d70a # v4.0.0 - - - name: Set up Docker Buildx - uses: docker/setup-buildx-action@4d04d5d9486b7bd6fa91e7baf45bbb4f8b9deedd # v4.0.0 - - name: Build binaries and Docker image with GoReleaser uses: goreleaser/goreleaser-action@ec59f474b9834571250b370d4735c50f8e2d1e29 # v7.0.0 with: version: '~> v2' args: release --snapshot - - name: Find snapshot image - id: find-image - run: | - IMAGE=$(docker images 'ghcr.io/patrickhoefler/dockerfilegraph' --format '{{.Repository}}:{{.Tag}}' | head -1) - echo "image=$IMAGE" >> "$GITHUB_OUTPUT" - # Smoke tests - name: Get the version run: | docker run \ - ${{ steps.find-image.outputs.image }} \ + ghcr.io/patrickhoefler/dockerfilegraph:latest \ --version - name: Run the Docker image with flags @@ -134,7 +122,7 @@ jobs: --user "$(id -u):$(id -g)" \ --workdir /workspace \ --volume "$(pwd)":/workspace \ - ${{ steps.find-image.outputs.image }} \ + ghcr.io/patrickhoefler/dockerfilegraph:latest \ --legend \ --output png \ --dpi 200 diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index b5d6c42..ae9eaeb 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -38,12 +38,6 @@ jobs: with: go-version-file: '.go-version' - - name: Set up QEMU - uses: docker/setup-qemu-action@ce360397dd3f832beb865e1373c09c0e9f86d70a # v4.0.0 - - - name: Set up Docker Buildx - uses: docker/setup-buildx-action@4d04d5d9486b7bd6fa91e7baf45bbb4f8b9deedd # v4.0.0 - - name: Login to GitHub Container Registry uses: docker/login-action@b45d80f862d83dbcd57f89517bcf500b2ab88fb2 # v4.0.0 with: diff --git a/.goreleaser.yaml b/.goreleaser.yaml index 9c1b71b..cc61c2b 100644 --- a/.goreleaser.yaml +++ b/.goreleaser.yaml @@ -16,23 +16,19 @@ builds: changelog: disable: true -dockers_v2: - - images: - - 'ghcr.io/patrickhoefler/dockerfilegraph' - tags: - - 'latest' - - '{{ .Major }}' - - '{{ .Major }}.{{ .Minor }}' - - '{{ .Major }}.{{ .Minor }}.{{ .Patch }}' +dockers: + - dockerfile: Dockerfile + image_templates: + - 'ghcr.io/patrickhoefler/dockerfilegraph:latest' + - 'ghcr.io/patrickhoefler/dockerfilegraph:{{ .Major }}' + - 'ghcr.io/patrickhoefler/dockerfilegraph:{{ .Major }}.{{ .Minor }}' + - 'ghcr.io/patrickhoefler/dockerfilegraph:{{ .Major }}.{{ .Minor }}.{{ .Patch }}' # for backwards compatibility - - 'alpine' - - 'latest-alpine' - - '{{ .Major }}-alpine' - - '{{ .Major }}.{{ .Minor }}-alpine' - - '{{ .Major }}.{{ .Minor }}.{{ .Patch }}-alpine' - platforms: - - linux/amd64 - - linux/arm64 + - 'ghcr.io/patrickhoefler/dockerfilegraph:alpine' + - 'ghcr.io/patrickhoefler/dockerfilegraph:latest-alpine' + - 'ghcr.io/patrickhoefler/dockerfilegraph:{{ .Major }}-alpine' + - 'ghcr.io/patrickhoefler/dockerfilegraph:{{ .Major }}.{{ .Minor }}-alpine' + - 'ghcr.io/patrickhoefler/dockerfilegraph:{{ .Major }}.{{ .Minor }}.{{ .Patch }}-alpine' homebrew_casks: - repository: diff --git a/Dockerfile b/Dockerfile index 063a73e..9383244 100644 --- a/Dockerfile +++ b/Dockerfile @@ -19,9 +19,8 @@ RUN apk add --update --no-cache \ # Run as non-root user USER app -# When using goreleaser, TARGETPLATFORM is set to e.g. linux/amd64. -# For local builds, it defaults to . (binary at the project root). -ARG TARGETPLATFORM=. -COPY $TARGETPLATFORM/dockerfilegraph / +# This only works after running `mise run build-linux` +# or when using goreleaser +COPY dockerfilegraph / ENTRYPOINT ["/dockerfilegraph"] From bc64e8d16f9530d278b4ccaa64499f32c0578a53 Mon Sep 17 00:00:00 2001 From: Patrick Hoefler Date: Fri, 27 Mar 2026 22:14:17 +0100 Subject: [PATCH 5/6] chore: gitignore workspace files, remove tracked one Co-Authored-By: Claude Sonnet 4.6 --- .gitignore | 1 + homebrew.code-workspace | 10 ---------- 2 files changed, 1 insertion(+), 10 deletions(-) delete mode 100644 homebrew.code-workspace diff --git a/.gitignore b/.gitignore index 9278f7b..73ab945 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,6 @@ # Visual Studio Code .vscode +*.code-workspace # Binaries for programs and plugins *.exe diff --git a/homebrew.code-workspace b/homebrew.code-workspace deleted file mode 100644 index d484f99..0000000 --- a/homebrew.code-workspace +++ /dev/null @@ -1,10 +0,0 @@ -{ - "folders": [ - { - "path": "." - }, - { - "path": "../homebrew-tap" - } - ] -} From 7e97ab3139d0694aab48b8dca86db04cbea414f3 Mon Sep 17 00:00:00 2001 From: Patrick Hoefler Date: Fri, 27 Mar 2026 22:43:26 +0100 Subject: [PATCH 6/6] docs: update Homebrew install command for cask migration The tap now distributes a cask instead of a formula, so the install command requires the --cask flag. Co-Authored-By: Claude Sonnet 4.6 --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 3d11664..27839ca 100644 --- a/README.md +++ b/README.md @@ -62,7 +62,7 @@ docker run --rm --user "$(id -u):$(id -g)" \ #### Homebrew ```shell -brew install patrickhoefler/tap/dockerfilegraph +brew install --cask patrickhoefler/tap/dockerfilegraph dockerfilegraph ```