Skip to content

Commit

Permalink
Allow to configure platforms for the built container image
Browse files Browse the repository at this point in the history
  • Loading branch information
SuperSandro2000 committed Sep 11, 2024
1 parent 6b5d158 commit a4944ca
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 1 deletion.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -411,12 +411,14 @@ If `enabled` is set to true, the generated `Dockerfile` is built for the platfor
```yaml
pushContainerToGhcr:
enabled: true
platforms: "linux/amd64,linux/arm64"
tagStrategy:
- edge
- latest
- semver
```

`platforms` configures for which platforms the multi-arch docker image is built. Defaults to `linux/amd64`. Note: emulation is provided by qemu and might take significant time.
`tagStrategy` influences which container tags will be pushed. Currently `edge`, `latest` and `semver` are supported.

### `githubWorkflow.release`
Expand Down
1 change: 1 addition & 0 deletions internal/core/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,7 @@ type LicenseWorkflowConfig struct {

type PushContainerToGhcrConfig struct {
Enabled bool `yaml:"enabled"`
Platforms string `yaml:"platforms"`
TagStrategy []string `yaml:"tagStrategy"`
}

Expand Down
7 changes: 6 additions & 1 deletion internal/ghworkflow/workflow_ghcr.go
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,11 @@ type=semver,pattern=v{{major}}
Name: "Set up Docker Buildx",
Uses: core.DockerBuildxAction,
})

platforms := cfg.PushContainerToGhcr.Platforms
if platforms == "" {
platforms = "linux/amd64"
}
j.addStep(jobStep{
Name: "Build and push Docker image",
Uses: core.DockerBuildPushAction,
Expand All @@ -114,7 +119,7 @@ type=semver,pattern=v{{major}}
"push": true,
"tags": "${{ steps.meta.outputs.tags }}",
"labels": "${{ steps.meta.outputs.labels }}",
"platforms": "linux/amd64,linux/arm64",
"platforms": platforms,
},
})
w.Jobs = map[string]job{"build-and-push-image": j}
Expand Down

0 comments on commit a4944ca

Please sign in to comment.