From 1a78ec9234ac6acd75612066c7e8cbf9bbefca2f Mon Sep 17 00:00:00 2001 From: Alex Ellis Date: Wed, 30 Aug 2017 11:11:29 +0100 Subject: [PATCH] Make dockerfile multi-arch Signed-off-by: Alex Ellis --- watchdog/.gitignore | 3 +++ watchdog/Dockerfile | 8 +++++--- watchdog/Dockerfile.armhf | 14 -------------- watchdog/Dockerfile.win | 14 -------------- watchdog/build.sh | 2 ++ 5 files changed, 10 insertions(+), 31 deletions(-) delete mode 100644 watchdog/Dockerfile.armhf delete mode 100644 watchdog/Dockerfile.win diff --git a/watchdog/.gitignore b/watchdog/.gitignore index 745147fe..bbcd5920 100644 --- a/watchdog/.gitignore +++ b/watchdog/.gitignore @@ -1,3 +1,6 @@ fwatchdog watchdog fwatchdog-armhf +fwatchdog.exe +watchdog.exe + diff --git a/watchdog/Dockerfile b/watchdog/Dockerfile index de371d2a..4918fe93 100644 --- a/watchdog/Dockerfile +++ b/watchdog/Dockerfile @@ -6,10 +6,12 @@ COPY main.go . COPY readconfig.go . COPY config_test.go . COPY requesthandler_test.go . +COPY fastForkRequestHandler.go . +COPY requestHandler.go . COPY types types RUN go test -RUN CGO_ENABLED=0 GOOS=linux go build -a -installsuffix cgo -o watchdog . - -RUN GOARM=6 GOARCH=arm CGO_ENABLED=0 GOOS=linux go build -a -installsuffix cgo -o watchdog-armhf . +RUN CGO_ENABLED=0 GOOS=linux go build -a -installsuffix cgo -o watchdog . \ + && GOARM=6 GOARCH=arm CGO_ENABLED=0 GOOS=linux go build -a -installsuffix cgo -o watchdog-armhf . \ + && GOOS=windows CGO_ENABLED=0 go build -a -installsuffix cgo -o watchdog.exe . diff --git a/watchdog/Dockerfile.armhf b/watchdog/Dockerfile.armhf deleted file mode 100644 index ecbf6ce2..00000000 --- a/watchdog/Dockerfile.armhf +++ /dev/null @@ -1,14 +0,0 @@ -FROM alexellis2/go-armhf:1.7.4 -RUN mkdir -p /go/src/github.com/alexellis/faas/watchdog -WORKDIR /go/src/github.com/alexellis/faas/watchdog - -COPY main.go . -COPY readconfig.go . -COPY config_test.go . -COPY requesthandler_test.go . -COPY types types - -#RUN go get -d -v - -RUN go test -RUN CGO_ENABLED=0 GOOS=linux go build -a -installsuffix cgo -o watchdog . diff --git a/watchdog/Dockerfile.win b/watchdog/Dockerfile.win deleted file mode 100644 index 4560069a..00000000 --- a/watchdog/Dockerfile.win +++ /dev/null @@ -1,14 +0,0 @@ -FROM golang:1.7.5-windowsservercore -RUN mkdir -p /go/src/github.com/alexellis/faas/watchdog -WORKDIR /go/src/github.com/alexellis/faas/watchdog - -COPY main.go . -COPY readconfig.go . -COPY config_test.go . -COPY requesthandler_test.go . -COPY types types - -RUN go test -env CGO_ENABLED=0 -env GOOS=windows -RUN go build -a -installsuffix cgo -o watchdog.exe . diff --git a/watchdog/build.sh b/watchdog/build.sh index 165a5e16..55b8e823 100755 --- a/watchdog/build.sh +++ b/watchdog/build.sh @@ -12,6 +12,8 @@ fi docker create --name buildoutput functions/watchdog:build echo docker cp buildoutput:/go/src/github.com/alexellis/faas/watchdog/watchdog ./fwatchdog + docker cp buildoutput:/go/src/github.com/alexellis/faas/watchdog/watchdog-armhf ./fwatchdog-armhf +docker cp buildoutput:/go/src/github.com/alexellis/faas/watchdog/watchdog.exe ./fwatchdog.exe docker rm buildoutput