mirror of
https://github.com/openfaas/faas.git
synced 2025-06-18 12:06:37 +00:00
Include markdown sample
Fix UI refresh problem Enable invocation from portal
This commit is contained in:
16
sample-functions/MarkdownRender/Dockerfile
Normal file
16
sample-functions/MarkdownRender/Dockerfile
Normal file
@ -0,0 +1,16 @@
|
||||
FROM alpine:latest
|
||||
|
||||
WORKDIR /root/
|
||||
|
||||
EXPOSE 8080
|
||||
ENV http_proxy ""
|
||||
ENV https_proxy ""
|
||||
|
||||
ADD https://github.com/alexellis/faas/releases/download/v0.3-alpha/fwatchdog /usr/bin
|
||||
RUN chmod +x /usr/bin/fwatchdog
|
||||
# COPY fwatchdog /usr/bin/
|
||||
|
||||
COPY app .
|
||||
|
||||
ENV fprocess="/root/app"
|
||||
CMD ["fwatchdog"]
|
10
sample-functions/MarkdownRender/Dockerfile.build
Normal file
10
sample-functions/MarkdownRender/Dockerfile.build
Normal file
@ -0,0 +1,10 @@
|
||||
FROM golang:1.7.3
|
||||
RUN mkdir -p /go/src/app
|
||||
COPY handler.go /go/src/app
|
||||
WORKDIR /go/src/app
|
||||
RUN go get github.com/microcosm-cc/bluemonday && \
|
||||
go get github.com/russross/blackfriday
|
||||
|
||||
RUN CGO_ENABLED=0 GOOS=linux go build -a -installsuffix cgo -o app .
|
||||
|
||||
CMD ["echo"]
|
BIN
sample-functions/MarkdownRender/MarkdownRender
Executable file
BIN
sample-functions/MarkdownRender/MarkdownRender
Executable file
Binary file not shown.
BIN
sample-functions/MarkdownRender/app
Executable file
BIN
sample-functions/MarkdownRender/app
Executable file
Binary file not shown.
12
sample-functions/MarkdownRender/build.sh
Executable file
12
sample-functions/MarkdownRender/build.sh
Executable file
@ -0,0 +1,12 @@
|
||||
#!/bin/sh
|
||||
echo Building alexellis2/faas-markdownrender:build
|
||||
|
||||
docker build --build-arg https_proxy=$https_proxy --build-arg http_proxy=$http_proxy \
|
||||
-t alexellis2/faas-markdownrender . -f Dockerfile.build
|
||||
|
||||
docker create --name render_extract alexellis2/faas-markdownrender
|
||||
docker cp render_extract:/go/src/app/app ./app
|
||||
docker rm -f render_extract
|
||||
|
||||
echo Building alexellis2/faas-markdownrender:latest
|
||||
docker build --no-cache -t alexellis2/faas-markdownrender:latest .
|
17
sample-functions/MarkdownRender/handler.go
Normal file
17
sample-functions/MarkdownRender/handler.go
Normal file
@ -0,0 +1,17 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"os"
|
||||
|
||||
"github.com/microcosm-cc/bluemonday"
|
||||
"github.com/russross/blackfriday"
|
||||
)
|
||||
|
||||
func main() {
|
||||
input, _ := ioutil.ReadAll(os.Stdin)
|
||||
unsafe := blackfriday.MarkdownCommon([]byte(input))
|
||||
html := bluemonday.UGCPolicy().SanitizeBytes(unsafe)
|
||||
fmt.Println(string(html))
|
||||
}
|
Reference in New Issue
Block a user