-
Notifications
You must be signed in to change notification settings - Fork 71
Refactor image build, create multi-arch images, drop Builder usage #347
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 11 commits
Commits
Show all changes
24 commits
Select commit
Hold shift + click to select a range
23e02d9
Refactor image build, create multi-arch images, drop Builder usage
sairon a79a9a9
Add readme entry with instructions for local builds
sairon fb9b3d9
Extract workflow and action to the builder repo
sairon 9d5fd38
Change underscores to dashes in workflow inputs
sairon faee5d2
Cleanup args in Python Dockerfiles
sairon ade0857
Add Supported platforms section to readme
sairon 8470f0b
Clarify Alpine base for Python in readme example
sairon 58e2b38
Explain permissions
sairon e6375ba
Update to match latest inputs, sort workflow inputs
sairon bcf14cf
Use local reusable workflow again
sairon 94b9b2b
Update for latest builder changes
sairon 9019660
Remove dropped multi-arch flag
sairon b2bc1fb
Merge remote-tracking branch 'origin/master' into use-no-builder
sairon bbe119b
Update S6 overlay, pip and Python to match master branch
sairon f4b29ae
Pin builder actions to release SHA
sairon 5ac7e03
Remove redundant contents permissions for manifest job
sairon fb16c31
Scope permissions to jobs
sairon 262d5b4
Expect TARGETARCH to be set by BuildKit
sairon 95d2de9
Use builder actions 2026.03.1
sairon 4c10a9c
Update reusable workflow description
sairon 2055d46
Update the readme with expected release number
sairon a35150d
Fix image names for debian/ubuntu
sairon ce7b18b
Fix image names in examples, add paragraph about multi-platform builds
sairon 54d26c6
Bump builder actions to 2026.03.2
sairon File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,173 @@ | ||
| name: Reusable workflow for single multi-arch image build | ||
|
|
||
| on: | ||
| workflow_call: | ||
| inputs: | ||
| architectures: | ||
| description: Architectures to build (JSON array, e.g., '["amd64", "aarch64"]') | ||
| required: true | ||
| type: string | ||
| build-args: | ||
| description: Additional build arguments (key=value format, one per line) | ||
| required: false | ||
| default: "" | ||
| type: string | ||
| cache-gha: | ||
| description: Whether to use GitHub Actions cache for build caching | ||
| required: false | ||
| default: true | ||
| type: boolean | ||
| cache-gha-scope: | ||
| description: Scope for build cache sharing (defaults to architecture, set if building multiple images from a single repo) | ||
| required: false | ||
| default: "" | ||
| type: string | ||
| cache-image-tag: | ||
| description: Tag of the image containing BuildKit inline cache metadata | ||
| required: false | ||
| default: "latest" | ||
| type: string | ||
| context: | ||
| description: Build context path (usually the directory with Dockerfile) | ||
| required: true | ||
| type: string | ||
| cosign: | ||
| description: Whether to sign images with Cosign | ||
| required: false | ||
| default: true | ||
| type: boolean | ||
| cosign-base-identity: | ||
| description: Certificate identity regexp for verifying the base (FROM) image | ||
| required: false | ||
| default: "" | ||
| type: string | ||
| cosign-base-issuer: | ||
| description: Certificate OIDC issuer regexp for base image verification (defaults to cosign-issuer) | ||
| required: false | ||
| default: "" | ||
| type: string | ||
| cosign-base-verify: | ||
| description: Base image reference to verify with cosign before building | ||
| required: false | ||
| default: "" | ||
| type: string | ||
| cosign-identity: | ||
| description: Certificate identity regexp for verifying cache images (defaults to current repo pattern) | ||
| required: false | ||
| default: "" | ||
| type: string | ||
| cosign-issuer: | ||
| description: Certificate OIDC issuer regexp for all cosign verification | ||
| required: false | ||
| default: "https://token.actions.githubusercontent.com" | ||
| type: string | ||
| file: | ||
| description: Dockerfile path (defaults to "Dockerfile" in the context directory) | ||
| required: false | ||
| default: "" | ||
| type: string | ||
| image-name: | ||
| description: Image name without a tag (e.g., "base-python") | ||
| required: true | ||
| type: string | ||
| image-tags: | ||
| description: Image tags, one per line | ||
| required: true | ||
| type: string | ||
| labels: | ||
| description: Additional OCI labels (key=value format, one per line) | ||
| required: false | ||
| default: "" | ||
| type: string | ||
| multi-arch: | ||
| description: Prefix per-arch image names with architecture (required for multiple architectures) | ||
| required: false | ||
| default: true | ||
| type: boolean | ||
| push: | ||
| description: Whether to push images to registry | ||
| required: false | ||
| default: false | ||
| type: boolean | ||
| version: | ||
| description: Image version label | ||
| required: true | ||
| type: string | ||
|
|
||
| jobs: | ||
| prepare: | ||
| name: Prepare build matrix | ||
| runs-on: ubuntu-latest | ||
| outputs: | ||
| matrix: ${{ steps.prepare.outputs.matrix }} | ||
| steps: | ||
| - name: Prepare multi-arch matrix | ||
| id: prepare | ||
| uses: home-assistant/builder/actions/prepare-multi-arch-matrix@gha-builder | ||
| with: | ||
| architectures: ${{ inputs.architectures }} | ||
| image-name: ${{ inputs.image-name }} | ||
| multi-arch: ${{ inputs.multi-arch }} | ||
|
|
||
| build: | ||
| name: Build ${{ matrix.arch }} image | ||
| needs: prepare | ||
| runs-on: ${{ matrix.os }} | ||
| permissions: | ||
| contents: read | ||
| id-token: write | ||
| packages: write | ||
| strategy: | ||
| fail-fast: false | ||
| matrix: ${{ fromJSON(needs.prepare.outputs.matrix) }} | ||
| steps: | ||
| - name: Checkout the repository | ||
| uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 | ||
| with: | ||
| persist-credentials: false | ||
|
|
||
| - name: Build image | ||
| id: build | ||
| uses: home-assistant/builder/actions/build-image@gha-builder | ||
| with: | ||
| arch: ${{ matrix.arch }} | ||
| build-args: ${{ inputs.build-args }} | ||
| cache-gha: ${{ inputs.cache-gha }} | ||
| cache-gha-scope: ${{ inputs.cache-gha-scope }} | ||
| cache-image-tag: ${{ inputs.cache-image-tag }} | ||
| container-registry-password: ${{ secrets.GITHUB_TOKEN }} | ||
| context: ${{ inputs.context }} | ||
| cosign: ${{ inputs.cosign }} | ||
| cosign-base-identity: ${{ inputs.cosign-base-identity }} | ||
| cosign-base-issuer: ${{ inputs.cosign-base-issuer }} | ||
| cosign-base-verify: ${{ inputs.cosign-base-verify }} | ||
| cosign-identity: ${{ inputs.cosign-identity }} | ||
| cosign-issuer: ${{ inputs.cosign-issuer }} | ||
| file: ${{ inputs.file }} | ||
| image: ${{ matrix.image }} | ||
| image-tags: ${{ inputs.image-tags }} | ||
| labels: | | ||
| io.hass.base.arch=${{ matrix.arch }} | ||
| io.hass.base.version=${{ inputs.version }} | ||
| ${{ inputs.labels }} | ||
| push: ${{ inputs.push }} | ||
| version: ${{ inputs.version }} | ||
|
|
||
| manifest: | ||
| name: Publish multi-arch manifest | ||
| if: inputs.push && inputs.multi-arch | ||
| needs: [prepare, build] | ||
| runs-on: ubuntu-latest | ||
| permissions: | ||
| contents: read | ||
| id-token: write | ||
| packages: write | ||
| steps: | ||
| - name: Publish multi-arch manifest | ||
| uses: home-assistant/builder/actions/publish-multi-arch-manifest@gha-builder | ||
| with: | ||
| architectures: ${{ inputs.architectures }} | ||
| container-registry-password: ${{ secrets.GITHUB_TOKEN }} | ||
| cosign: ${{ inputs.cosign }} | ||
| image-name: ${{ inputs.image-name }} | ||
| image-tags: ${{ inputs.image-tags }} | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.