File tree 3 files changed +13
-5
lines changed
3 files changed +13
-5
lines changed Original file line number Diff line number Diff line change 1
1
FROM microsoft/powershell:ubuntu-xenial
2
2
3
- RUN curl -sSLf https://github.com/openfaas-incubator/of-watchdog/releases/download/0.4.5/of-watchdog > /usr/bin/fwatchdog \
4
- && chmod +x /usr/bin/fwatchdog
5
- WORKDIR /root/
3
+ RUN apt-get update \
4
+ && apt-get install -y curl \
5
+ && curl -sSLf https://github.com/openfaas-incubator/of-watchdog/releases/download/0.4.5/of-watchdog > /usr/bin/fwatchdog \
6
+ && chmod +x /usr/bin/fwatchdog \
7
+ && apt-get clean \
8
+ && rm -rf /var/lib/apt/lists/*
6
9
7
10
COPY server.ps1 server.ps1
8
11
Original file line number Diff line number Diff line change 1
- Param (
1
+ function Handler {
2
+ Param (
2
3
[Parameter (Mandatory = $true )]
3
4
[FunctionContext ]$fnContext ,
4
5
[Parameter (Mandatory = $true )]
8
9
$output = " Hello! Your input was: " + $fnContext.Body
9
10
10
11
$fnResponse.Body = $output
12
+
13
+ }
Original file line number Diff line number Diff line change @@ -19,6 +19,8 @@ $listener = New-Object System.Net.HttpListener
19
19
$listener.Prefixes.Add (" http://*:8081/" )
20
20
$listener.Start ()
21
21
22
+ . " ./function/handler.ps1"
23
+
22
24
do {
23
25
$context = $listener.GetContext ()
24
26
$response = $context.Response
40
42
$fnResponse = [FunctionResponse ]::new()
41
43
$fnResponse.Headers = [System.Net.WebHeaderCollection ]::new()
42
44
try {
43
- . .\function\handler.ps1 - fnContext $fnContext - fnResponse $fnResponse
45
+ Handler - fnContext $fnContext - fnResponse $fnResponse
44
46
45
47
$Content = [System.Text.Encoding ]::UTF8.GetBytes($fnResponse.Body )
46
48
$response.StatusCode = $ (If ($fnResponse.Status ) {$fnResponse.Status } Else {200 }) # default to 200 response if not set
You can’t perform that action at this time.
0 commit comments