Signed-off-by: John Howard <jhoward@microsoft.com>
@@ -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,
@@ -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"