This repository has been archived on 2024-04-08. You can view files and clone it, but cannot push or open issues or pull requests.
dagger/plancontext/platform.go
Marcos Lilljedahl d80acf805b Add experimental way to set a target platform when building
Add an --experimental-platform flag to the do command to allow
overriding the default auto-detected build platform until we find the
time to think about the definitive multi-platform builds UX

Signed-off-by: Marcos Lilljedahl <marcosnils@gmail.com>
2022-04-05 18:24:14 -03:00

28 lines
500 B
Go

package plancontext
import (
"github.com/containerd/containerd/platforms"
specs "github.com/opencontainers/image-spec/specs-go/v1"
)
type platformContext struct {
platform *specs.Platform
}
func (c *platformContext) Get() specs.Platform {
return *c.platform
}
func (c *platformContext) SetString(platform string) error {
p, err := platforms.Parse(platform)
if err != nil {
return err
}
c.platform = &p
return nil
}
func (c *platformContext) Set(p specs.Platform) {
c.platform = &p
}