1
0
Fork 0
mirror of https://github.com/moby/moby.git synced 2022-11-09 12:21:53 -05:00

Merge pull request #37563 from Microsoft/jjh/fix-vso17531561v2

LCOW: Ensure platform is populated on COPY/ADD
This commit is contained in:
Yong Tang 2018-08-17 12:51:17 -07:00 committed by GitHub
commit 14d5569f19
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -82,13 +82,28 @@ type copier struct {
}
func copierFromDispatchRequest(req dispatchRequest, download sourceDownloader, imageSource *imageMount) copier {
platform := req.builder.platform
if platform == nil {
// May be nil if not explicitly set in API/dockerfile
platform = &specs.Platform{}
}
if platform.OS == "" {
// Default to the dispatch requests operating system if not explicit in API/dockerfile
platform.OS = req.state.operatingSystem
}
if platform.OS == "" {
// This is a failsafe just in case. Shouldn't be hit.
platform.OS = runtime.GOOS
}
return copier{
source: req.source,
pathCache: req.builder.pathCache,
download: download,
imageSource: imageSource,
platform: req.builder.platform,
platform: platform,
}
}
func (o *copier) createCopyInstruction(args []string, cmdName string) (copyInstruction, error) {