File tree Expand file tree Collapse file tree 3 files changed +13
-5
lines changed Expand file tree Collapse file tree 3 files changed +13
-5
lines changed Original file line number Diff line number Diff line change 11FROM microsoft/powershell:ubuntu-xenial
22
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/*
69
710COPY server.ps1 server.ps1
811
Original file line number Diff line number Diff line change 1- Param (
1+ function Handler {
2+ Param (
23 [Parameter (Mandatory = $true )]
34 [FunctionContext ]$fnContext ,
45 [Parameter (Mandatory = $true )]
89$output = " Hello! Your input was: " + $fnContext.Body
910
1011$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
1919$listener.Prefixes.Add (" http://*:8081/" )
2020$listener.Start ()
2121
22+ . " ./function/handler.ps1"
23+
2224do {
2325 $context = $listener.GetContext ()
2426 $response = $context.Response
4042 $fnResponse = [FunctionResponse ]::new()
4143 $fnResponse.Headers = [System.Net.WebHeaderCollection ]::new()
4244 try {
43- . .\function\handler.ps1 - fnContext $fnContext - fnResponse $fnResponse
45+ Handler - fnContext $fnContext - fnResponse $fnResponse
4446
4547 $Content = [System.Text.Encoding ]::UTF8.GetBytes($fnResponse.Body )
4648 $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