Browse code

Enabling expose support for Windows TP5

Signed-off-by: msabansal <sabansal@microsoft.com>

msabansal authored on 2016/03/31 07:54:16
Showing 3 changed files
... ...
@@ -21,7 +21,6 @@ package dockerfile
21 21
 
22 22
 import (
23 23
 	"fmt"
24
-	"runtime"
25 24
 	"strings"
26 25
 
27 26
 	"github.com/docker/docker/builder/dockerfile/command"
... ...
@@ -200,16 +199,3 @@ func (b *Builder) dispatch(stepN int, ast *parser.Node) error {
200 200
 
201 201
 	return fmt.Errorf("Unknown instruction: %s", upperCasedCmd)
202 202
 }
203
-
204
-// platformSupports is a short-term function to give users a quality error
205
-// message if a Dockerfile uses a command not supported on the platform.
206
-func platformSupports(command string) error {
207
-	if runtime.GOOS != "windows" {
208
-		return nil
209
-	}
210
-	switch command {
211
-	case "expose", "user", "stopsignal", "arg":
212
-		return fmt.Errorf("The daemon on this platform does not support the command '%s'", command)
213
-	}
214
-	return nil
215
-}
216 203
new file mode 100644
... ...
@@ -0,0 +1,9 @@
0
+// +build !windows
1
+
2
+package dockerfile
3
+
4
+// platformSupports is a short-term function to give users a quality error
5
+// message if a Dockerfile uses a command not supported on the platform.
6
+func platformSupports(command string) error {
7
+	return nil
8
+}
0 9
new file mode 100644
... ...
@@ -0,0 +1,26 @@
0
+// +build windows
1
+
2
+package dockerfile
3
+
4
+import (
5
+	"fmt"
6
+
7
+	"github.com/Microsoft/hcsshim"
8
+)
9
+
10
+// platformSupports is a short-term function to give users a quality error
11
+// message if a Dockerfile uses a command not supported on the platform.
12
+func platformSupports(command string) error {
13
+	switch command {
14
+	// TODO Windows TP5. Expose can be removed from here once TP4 is
15
+	// no longer supported.
16
+	case "expose":
17
+		if !hcsshim.IsTP4() {
18
+			break
19
+		}
20
+		fallthrough
21
+	case "user", "stopsignal", "arg":
22
+		return fmt.Errorf("The daemon on this platform does not support the command '%s'", command)
23
+	}
24
+	return nil
25
+}