Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions commands/cloud_deploy.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ type KoolCloudDeployFlags struct {
Timeout uint // env: KOOL_API_TIMEOUT
WwwRedirect bool // env: KOOL_DEPLOY_WWW_REDIRECT
DeployDomainExtras []string // env: KOOL_DEPLOY_DOMAIN_EXTRAS

Platform string // platform for docker build, e.g. linux/amd64
Copy link

Copilot AI May 22, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[nitpick] Consider expanding the comment to document the range of acceptable platform values for clarity.

Copilot uses AI. Check for mistakes.
// Cluster string // env: KOOL_DEPLOY_CLUSTER
}

Expand Down Expand Up @@ -53,6 +53,7 @@ func NewDeployCommand(deploy *KoolDeploy) (cmd *cobra.Command) {
cmd.Flags().StringArrayVarP(&deploy.flags.DeployDomainExtras, "domain-extra", "", []string{}, "List of extra domain aliases")
cmd.Flags().BoolVarP(&deploy.flags.WwwRedirect, "www-redirect", "", false, "Redirect www to non-www domain")
cmd.Flags().UintVarP(&deploy.flags.Timeout, "timeout", "", 0, "Timeout in minutes for waiting the deployment to finish")
cmd.Flags().StringVarP(&deploy.flags.Platform, "platform", "", "linux/amd64", "Platform for docker build (default: linux/amd64)")

return
}
Expand Down Expand Up @@ -123,7 +124,7 @@ func (d *KoolDeploy) Execute(args []string) (err error) {
if svc.Build != nil {
d.Shell().Info(" > Build deploy image for service '", svcName, "'")

if err = cloud.BuildPushImageForDeploy(svcName, svc, deployCreated); err != nil {
if err = cloud.BuildPushImageForDeploy(svcName, svc, deployCreated, d.flags.Platform); err != nil {
if reportErr := deployer.BuildError(deployCreated, err); reportErr != nil {
d.Shell().Error(fmt.Errorf("error reporting build error: %v", reportErr))
}
Expand Down
2 changes: 2 additions & 0 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ require github.com/compose-spec/compose-go v1.13.0

require (
github.com/Azure/go-ansiterm v0.0.0-20230124172434-306776ec8161 // indirect
github.com/cpuguy83/go-md2man/v2 v2.0.2 // indirect
Copy link

Copilot AI May 22, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[nitpick] Review whether this indirect dependency is necessary for the new ARM support to avoid unnecessary maintenance overhead.

Suggested change
github.com/cpuguy83/go-md2man/v2 v2.0.2 // indirect

Copilot uses AI. Check for mistakes.
github.com/fatih/color v1.15.0 // indirect
github.com/google/go-github/v30 v30.1.0 // indirect
github.com/google/go-querystring v1.1.0 // indirect
Expand All @@ -49,6 +50,7 @@ require (
github.com/mgutz/ansi v0.0.0-20200706080929-d51e80ef957d // indirect
github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e // indirect
github.com/rivo/uniseg v0.4.4 // indirect
github.com/russross/blackfriday/v2 v2.1.0 // indirect
github.com/sirupsen/logrus v1.9.0 // indirect
github.com/spf13/pflag v1.0.5 // indirect
github.com/tcnksm/go-gitconfig v0.1.2 // indirect
Expand Down
2 changes: 2 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ github.com/cncf/udpa/go v0.0.0-20200629203442-efcf912fb354/go.mod h1:WmhPx2Nbnht
github.com/cncf/udpa/go v0.0.0-20201120205902-5459f2c99403/go.mod h1:WmhPx2Nbnhtbo57+VJT5O0JRkEi1Wbu0z5j0R8u5Hbk=
github.com/compose-spec/compose-go v1.13.0 h1:HHMc1XvnHJr9LUS7fPiiQeTSmGtEp+myn7jGnXgIoXE=
github.com/compose-spec/compose-go v1.13.0/go.mod h1:uo+YhhqDpkW9MjZNzJgOLX3MlbK6zHaBo9n8LhGDwsg=
github.com/cpuguy83/go-md2man/v2 v2.0.2 h1:p1EgwI/C7NhT0JmVkwCD2ZBK8j4aeHQX2pMHHBfMQ6w=
github.com/cpuguy83/go-md2man/v2 v2.0.2/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o=
github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E=
github.com/creack/pty v1.1.17/go.mod h1:MOBLtS5ELjhRRrroQr9kyvTxUAFNvYEK993ew/Vr4O4=
Expand Down Expand Up @@ -221,6 +222,7 @@ github.com/rivo/uniseg v0.2.0/go.mod h1:J6wj4VEh+S6ZtnVlnTBMWIodfgj8LQOQFoIToxlJ
github.com/rivo/uniseg v0.4.4 h1:8TfxU8dW6PdqD27gjM8MVNuicgxIjxpm4K7x4jp8sis=
github.com/rivo/uniseg v0.4.4/go.mod h1:FN3SvrM+Zdj16jyLfmOkMNblXMcoc8DfTHruCPUcx88=
github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4=
github.com/russross/blackfriday/v2 v2.1.0 h1:JIOH55/0cWyOuilr9/qlrm0BSXldqnqwMsf35Ld67mk=
github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM=
github.com/sirupsen/logrus v1.9.0 h1:trlNQbNUG3OdDrDil03MCb1H2o9nJ1x4/5LYw7byDE0=
github.com/sirupsen/logrus v1.9.0/go.mod h1:naHLuLoDiP4jHNo9R0sCBMtWGeIprob74mVsIT4qYEQ=
Expand Down
4 changes: 2 additions & 2 deletions services/cloud/build.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import (
yaml "gopkg.in/yaml.v2"
)

func BuildPushImageForDeploy(service string, config *DeployConfigService, deploy *api.DeployCreateResponse) (err error) {
func BuildPushImageForDeploy(service string, config *DeployConfigService, deploy *api.DeployCreateResponse, platform string) (err error) {
if config.Build == nil {
err = errors.New("service " + service + " has no build configuration")
return
Expand All @@ -33,7 +33,7 @@ func BuildPushImageForDeploy(service string, config *DeployConfigService, deploy
var in = bytes.NewBuffer([]byte{})
sh.SetInStream(in)

dockerBuild := builder.NewCommand("docker", "build", "-t", image, "--platform", "linux/amd64")
dockerBuild := builder.NewCommand("docker", "build", "-t", image, "--platform", platform)

if folder, isStr := (*config.Build).(string); isStr {
// this should be a simple build with a context folder
Expand Down
Loading