Merge pull request #955 from tonistiigi/arm-variant
exporter: put arm variant in the image configdocker-19.03
commit
9a18f80403
|
@ -5,12 +5,12 @@ import (
|
||||||
"context"
|
"context"
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"fmt"
|
"fmt"
|
||||||
"runtime"
|
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/containerd/containerd/content"
|
"github.com/containerd/containerd/content"
|
||||||
"github.com/containerd/containerd/diff"
|
"github.com/containerd/containerd/diff"
|
||||||
"github.com/containerd/containerd/images"
|
"github.com/containerd/containerd/images"
|
||||||
|
"github.com/containerd/containerd/platforms"
|
||||||
"github.com/moby/buildkit/cache"
|
"github.com/moby/buildkit/cache"
|
||||||
"github.com/moby/buildkit/cache/blobs"
|
"github.com/moby/buildkit/cache/blobs"
|
||||||
"github.com/moby/buildkit/exporter"
|
"github.com/moby/buildkit/exporter"
|
||||||
|
@ -291,9 +291,21 @@ func (ic *ImageWriter) ContentStore() content.Store {
|
||||||
}
|
}
|
||||||
|
|
||||||
func emptyImageConfig() ([]byte, error) {
|
func emptyImageConfig() ([]byte, error) {
|
||||||
img := ocispec.Image{
|
pl := platforms.Normalize(platforms.DefaultSpec())
|
||||||
Architecture: runtime.GOARCH,
|
|
||||||
OS: runtime.GOOS,
|
type image struct {
|
||||||
|
ocispec.Image
|
||||||
|
|
||||||
|
// Variant defines platform variant. To be added to OCI.
|
||||||
|
Variant string `json:"variant,omitempty"`
|
||||||
|
}
|
||||||
|
|
||||||
|
img := image{
|
||||||
|
Image: ocispec.Image{
|
||||||
|
Architecture: pl.Architecture,
|
||||||
|
OS: pl.OS,
|
||||||
|
},
|
||||||
|
Variant: pl.Variant,
|
||||||
}
|
}
|
||||||
img.RootFS.Type = "layers"
|
img.RootFS.Type = "layers"
|
||||||
img.Config.WorkingDir = "/"
|
img.Config.WorkingDir = "/"
|
||||||
|
|
|
@ -390,6 +390,7 @@ func Dockerfile2LLB(ctx context.Context, dt []byte, opt ConvertOpt) (*llb.State,
|
||||||
if !platformOpt.implicitTarget {
|
if !platformOpt.implicitTarget {
|
||||||
target.image.OS = platformOpt.targetPlatform.OS
|
target.image.OS = platformOpt.targetPlatform.OS
|
||||||
target.image.Architecture = platformOpt.targetPlatform.Architecture
|
target.image.Architecture = platformOpt.targetPlatform.Architecture
|
||||||
|
target.image.Variant = platformOpt.targetPlatform.Variant
|
||||||
}
|
}
|
||||||
|
|
||||||
return &st, &target.image, nil
|
return &st, &target.image, nil
|
||||||
|
|
|
@ -50,6 +50,9 @@ type Image struct {
|
||||||
|
|
||||||
// Config defines the execution parameters which should be used as a base when running a container using the image.
|
// Config defines the execution parameters which should be used as a base when running a container using the image.
|
||||||
Config ImageConfig `json:"config,omitempty"`
|
Config ImageConfig `json:"config,omitempty"`
|
||||||
|
|
||||||
|
// Variant defines platform variant. To be added to OCI.
|
||||||
|
Variant string `json:"variant,omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
func clone(src Image) Image {
|
func clone(src Image) Image {
|
||||||
|
@ -67,6 +70,7 @@ func emptyImage(platform specs.Platform) Image {
|
||||||
Architecture: platform.Architecture,
|
Architecture: platform.Architecture,
|
||||||
OS: platform.OS,
|
OS: platform.OS,
|
||||||
},
|
},
|
||||||
|
Variant: platform.Variant,
|
||||||
}
|
}
|
||||||
img.RootFS.Type = "layers"
|
img.RootFS.Type = "layers"
|
||||||
img.Config.WorkingDir = "/"
|
img.Config.WorkingDir = "/"
|
||||||
|
|
Loading…
Reference in New Issue