From 1eaf13c6c80a02eef14b427fa3f273d8ea773b0c Mon Sep 17 00:00:00 2001 From: Alex Ellis Date: Thu, 27 Apr 2017 09:12:15 +0100 Subject: [PATCH] Windows port - spike (#66) * Add Windows Dockerfile.win * Create appveyor.yml * Create build.ps1 * Port Golang example to Windows --- appveyor.yml | 12 ++++++++++++ .../BaseFunctions/golang/Dockerfile.win | 16 ++++++++++++++++ watchdog/Dockerfile.win | 14 ++++++++++++++ watchdog/build.ps1 | 6 ++++++ 4 files changed, 48 insertions(+) create mode 100644 appveyor.yml create mode 100644 sample-functions/BaseFunctions/golang/Dockerfile.win create mode 100644 watchdog/Dockerfile.win create mode 100644 watchdog/build.ps1 diff --git a/appveyor.yml b/appveyor.yml new file mode 100644 index 00000000..254895d7 --- /dev/null +++ b/appveyor.yml @@ -0,0 +1,12 @@ +version: 1.0.{build} +image: Visual Studio 2017 + +install: + - docker version + +build_script: + - ps: .\watchdog\build.ps1 + +artifacts: + - path: watchdog\watchdog.exe + name: watchdog diff --git a/sample-functions/BaseFunctions/golang/Dockerfile.win b/sample-functions/BaseFunctions/golang/Dockerfile.win new file mode 100644 index 00000000..73315bab --- /dev/null +++ b/sample-functions/BaseFunctions/golang/Dockerfile.win @@ -0,0 +1,16 @@ +FROM golang:1.7.5-windowsservercore +MAINTAINER alexellis2@gmail.com +ENTRYPOINT [] + +WORKDIR /go/src/github.com/alexellis/faas/sample-functions/golang +COPY . /go/src/github.com/alexellis/faas/sample-functions/golang +RUN go build + +ADD ./watchdog.exe / + +EXPOSE 8080 +ENV fprocess="app.exe" + +ENV suppress_lock="true" + +CMD ["watchdog.exe"] diff --git a/watchdog/Dockerfile.win b/watchdog/Dockerfile.win new file mode 100644 index 00000000..4560069a --- /dev/null +++ b/watchdog/Dockerfile.win @@ -0,0 +1,14 @@ +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.ps1 b/watchdog/build.ps1 new file mode 100644 index 00000000..a12f5fd0 --- /dev/null +++ b/watchdog/build.ps1 @@ -0,0 +1,6 @@ +pwd +cd watchdog + +docker build -t alexellis2/watchdog:windows . -f .\Dockerfile.win +docker create --name watchdog alexellis2/watchdog:windows cmd +docker cp watchdog:/go/src/github.com/alexellis/faas/watchdog/watchdog.exe .