Skip to content

Commit 07e9e35

Browse files
burtonralexellis
authored andcommitted
Add curl to Dockerfile
base image does not contain any packages. Need to add curl to be able to pull in the watchdog binary Signed-off-by: Burton Rheutan <[email protected]>
1 parent 771c9a1 commit 07e9e35

File tree

3 files changed

+13
-5
lines changed

3 files changed

+13
-5
lines changed

template/powershell-http/Dockerfile

+6-3
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,11 @@
11
FROM 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

710
COPY server.ps1 server.ps1
811

template/powershell-http/function/handler.ps1

+4-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
Param(
1+
function Handler {
2+
Param(
23
[Parameter(Mandatory=$true)]
34
[FunctionContext]$fnContext,
45
[Parameter(Mandatory=$true)]
@@ -8,3 +9,5 @@ Param(
89
$output = "Hello! Your input was: " + $fnContext.Body
910

1011
$fnResponse.Body = $output
12+
13+
}

template/powershell-http/server.ps1

+3-1
Original file line numberDiff line numberDiff 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+
2224
do {
2325
$context = $listener.GetContext()
2426
$response = $context.Response
@@ -40,7 +42,7 @@ do {
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

0 commit comments

Comments
 (0)