Make dockerfile multi-arch

Signed-off-by: Alex Ellis <alexellis2@gmail.com>
This commit is contained in:
Alex Ellis 2017-08-30 11:11:29 +01:00
parent fdb67e3d93
commit 1a78ec9234
5 changed files with 10 additions and 31 deletions

3
watchdog/.gitignore vendored
View File

@ -1,3 +1,6 @@
fwatchdog
watchdog
fwatchdog-armhf
fwatchdog.exe
watchdog.exe

View File

@ -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 .

View File

@ -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 .

View File

@ -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 .

View File

@ -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