Merge pull request #955 from tonistiigi/arm-variant

exporter: put arm variant in the image config
docker-19.03
Tõnis Tiigi 2019-04-23 08:09:00 -07:00 committed by GitHub
commit 9a18f80403
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 21 additions and 4 deletions

View File

@ -5,12 +5,12 @@ import (
"context"
"encoding/json"
"fmt"
"runtime"
"time"
"github.com/containerd/containerd/content"
"github.com/containerd/containerd/diff"
"github.com/containerd/containerd/images"
"github.com/containerd/containerd/platforms"
"github.com/moby/buildkit/cache"
"github.com/moby/buildkit/cache/blobs"
"github.com/moby/buildkit/exporter"
@ -291,9 +291,21 @@ func (ic *ImageWriter) ContentStore() content.Store {
}
func emptyImageConfig() ([]byte, error) {
img := ocispec.Image{
Architecture: runtime.GOARCH,
OS: runtime.GOOS,
pl := platforms.Normalize(platforms.DefaultSpec())
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.Config.WorkingDir = "/"

View File

@ -390,6 +390,7 @@ func Dockerfile2LLB(ctx context.Context, dt []byte, opt ConvertOpt) (*llb.State,
if !platformOpt.implicitTarget {
target.image.OS = platformOpt.targetPlatform.OS
target.image.Architecture = platformOpt.targetPlatform.Architecture
target.image.Variant = platformOpt.targetPlatform.Variant
}
return &st, &target.image, nil

View File

@ -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 ImageConfig `json:"config,omitempty"`
// Variant defines platform variant. To be added to OCI.
Variant string `json:"variant,omitempty"`
}
func clone(src Image) Image {
@ -67,6 +70,7 @@ func emptyImage(platform specs.Platform) Image {
Architecture: platform.Architecture,
OS: platform.OS,
},
Variant: platform.Variant,
}
img.RootFS.Type = "layers"
img.Config.WorkingDir = "/"