Make webhookstash a static binary

This commit is contained in:
Alex Ellis 2017-04-13 22:58:32 +01:00
parent 2575ef407d
commit ee95e272cc
6 changed files with 32 additions and 15 deletions

View File

@ -21,7 +21,7 @@ echo
function test_function_output {
for i in {1..100}
do
out=$(curl -s localhost:8080/function/$1 -d "$2")
out=$(curl --fail -s localhost:8080/function/$1 -d "$2")
echo $out
if [ "$out" == "$3" ]
then
@ -41,7 +41,7 @@ echo
function test_function {
for i in {1..100}
do
curl localhost:8080/function/$1 -d "$2"
curl -s --fail localhost:8080/function/$1 -d "$2"
if [ ! 0 -eq $? ]
then
echo "Service $1 not ready"
@ -58,7 +58,7 @@ echo
function create_function {
echo "Creating function: " $1
curl -s localhost:8080/system/functions -d "$1"
curl -s --fail localhost:8080/system/functions -d "$1"
}
test_gateway

View File

@ -34,7 +34,6 @@ services:
placement:
constraints: [node.role == manager]
alertmanager:
image: quay.io/prometheus/alertmanager
environment:
@ -55,7 +54,7 @@ services:
# Service label of "function" allows functions to show up in UI on http://gateway:8080/
webhookstash:
image: alexellis2/faas-webhookstash:latest
image: functions/webhookstash:latest
labels:
function: "true"
depends_on:

View File

@ -0,0 +1 @@
app

View File

@ -1,15 +1,16 @@
FROM golang:1.7.5
RUN mkdir -p /go/src/app
COPY handler.go /go/src/app
WORKDIR /go/src/app
RUN go get -d -v
RUN CGO_ENABLED=0 GOOS=linux go build -a -installsuffix cgo -o app .
FROM alpine:latest
WORKDIR /root/
ADD https://github.com/alexellis/faas/releases/download/0.5.1-alpha/fwatchdog /usr/bin
EXPOSE 8080
ENV http_proxy ""
ENV https_proxy ""
ADD https://github.com/alexellis/faas/releases/download/v0.5-alpha/fwatchdog /usr/bin
RUN chmod +x /usr/bin/fwatchdog
# COPY fwatchdog /usr/bin/
ENV fprocess="/go/src/app/app"
COPY app .
ENV fprocess="/root/app"
CMD ["fwatchdog"]

View File

@ -0,0 +1,9 @@
FROM golang:1.7.5
RUN mkdir -p /go/src/app
COPY handler.go /go/src/app
WORKDIR /go/src/app
RUN go get -d -v
RUN CGO_ENABLED=0 GOOS=linux go build -a -installsuffix cgo -o app .
CMD ["/bin/true"]

View File

@ -1,3 +1,10 @@
#!/bin/bash
#!/bin/sh
echo Building functions/webhookstash:build
docker build -t alexellis2/faas-webhookstash .
docker build --build-arg https_proxy=$https_proxy --build-arg http_proxy=$http_proxy -t functions/webhookstash:build . -f Dockerfile.build && \
docker create --name hook_extract functions/webhookstash:build
docker cp hook_extract:/go/src/app/app ./app
docker rm -f hook_extract
echo Building functions/webhookstash:latest
docker build --no-cache -t functions/webhookstash:latest .