Skip to content

Commit f444973

Browse files
committed
Add Support to Kool Cloud Deploy to ARM
1 parent 0118d51 commit f444973

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

commands/cloud_deploy.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ type KoolCloudDeployFlags struct {
2424
Timeout uint // env: KOOL_API_TIMEOUT
2525
WwwRedirect bool // env: KOOL_DEPLOY_WWW_REDIRECT
2626
DeployDomainExtras []string // env: KOOL_DEPLOY_DOMAIN_EXTRAS
27-
27+
Platform string // platform for docker build, e.g. linux/amd64
2828
// Cluster string // env: KOOL_DEPLOY_CLUSTER
2929
}
3030

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

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

126-
if err = cloud.BuildPushImageForDeploy(svcName, svc, deployCreated); err != nil {
127+
if err = cloud.BuildPushImageForDeploy(svcName, svc, deployCreated, d.flags.Platform); err != nil {
127128
if reportErr := deployer.BuildError(deployCreated, err); reportErr != nil {
128129
d.Shell().Error(fmt.Errorf("error reporting build error: %v", reportErr))
129130
}

services/cloud/build.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ import (
1515
yaml "gopkg.in/yaml.v2"
1616
)
1717

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

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

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

0 commit comments

Comments
 (0)