Browse Source

Builder - dockerfile - just use API for now, and unit test fix

Signed-off-by: John Howard <jhoward@microsoft.com>
John Howard 7 years ago
parent
commit
735e5d22b7
2 changed files with 4 additions and 9 deletions
  1. 3 9
      builder/dockerfile/builder.go
  2. 1 0
      builder/dockerfile/dispatchers_test.go

+ 3 - 9
builder/dockerfile/builder.go

@@ -105,17 +105,11 @@ func (bm *BuildManager) Build(ctx context.Context, config backend.BuildConfig) (
 	}
 
 	os := runtime.GOOS
-	optionsPlatform := system.ParsePlatform(config.Options.Platform)
-	if dockerfile.OS != "" {
-		if optionsPlatform.OS != "" && optionsPlatform.OS != dockerfile.OS {
-			return nil, fmt.Errorf("invalid platform")
-		}
-		os = dockerfile.OS
-	} else if optionsPlatform.OS != "" {
-		os = optionsPlatform.OS
+	apiPlatform := system.ParsePlatform(config.Options.Platform)
+	if apiPlatform.OS != "" {
+		os = apiPlatform.OS
 	}
 	config.Options.Platform = os
-	dockerfile.OS = os
 
 	builderOptions := builderOptions{
 		Options:        config.Options,

+ 1 - 0
builder/dockerfile/dispatchers_test.go

@@ -208,6 +208,7 @@ func TestOnbuild(t *testing.T) {
 func TestWorkdir(t *testing.T) {
 	b := newBuilderWithMockBackend()
 	sb := newDispatchRequest(b, '`', nil, newBuildArgs(make(map[string]*string)), newStagesBuildResults())
+	sb.state.baseImage = &mockImage{}
 	workingDir := "/app"
 	if runtime.GOOS == "windows" {
 		workingDir = "C:\\app"