github.com/GoogleContainerTools/skaffold@v1.39.18/pkg/skaffold/build/buildpacks/build.go (about) 1 /* 2 Copyright 2019 The Skaffold Authors 3 4 Licensed under the Apache License, Version 2.0 (the "License"); 5 you may not use this file except in compliance with the License. 6 You may obtain a copy of the License at 7 8 http://www.apache.org/licenses/LICENSE-2.0 9 10 Unless required by applicable law or agreed to in writing, software 11 distributed under the License is distributed on an "AS IS" BASIS, 12 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 See the License for the specific language governing permissions and 14 limitations under the License. 15 */ 16 17 package buildpacks 18 19 import ( 20 "context" 21 "fmt" 22 "io" 23 24 v1 "github.com/opencontainers/image-spec/specs-go/v1" 25 26 "github.com/GoogleContainerTools/skaffold/pkg/skaffold/output/log" 27 "github.com/GoogleContainerTools/skaffold/pkg/skaffold/platform" 28 "github.com/GoogleContainerTools/skaffold/pkg/skaffold/schema/latest" 29 ) 30 31 // Build builds an artifact with Cloud Native Buildpacks: 32 // https://buildpacks.io/ 33 func (b *Builder) Build(ctx context.Context, out io.Writer, artifact *latest.Artifact, tag string, matcher platform.Matcher) (string, error) { 34 if matcher.IsMultiPlatform() { 35 // TODO: Implement building multiplatform images 36 log.Entry(ctx).Warnf("multiple target platforms %q found for artifact %q. Skaffold doesn't yet support multi-platform builds for the buildpacks builder. Consider specifying a single target platform explicitly. See https://skaffold.dev/docs/pipeline-stages/builders/#cross-platform-build-support", matcher.String(), artifact.ImageName) 37 } 38 39 built, err := b.build(ctx, out, artifact, tag) 40 if err != nil { 41 return "", err 42 } 43 44 if err := b.localDocker.Tag(ctx, built, tag); err != nil { 45 return "", fmt.Errorf("tagging %s->%q: %w", built, tag, err) 46 } 47 48 if b.pushImages { 49 return b.localDocker.Push(ctx, out, tag) 50 } 51 return b.localDocker.ImageID(ctx, tag) 52 } 53 54 func (b *Builder) SupportedPlatforms() platform.Matcher { 55 return platform.Matcher{Platforms: []v1.Platform{{OS: "linux", Architecture: "amd64"}}} 56 }