diff --git a/template/crystal/Dockerfile b/template/crystal/Dockerfile deleted file mode 100644 index e92cbce..0000000 --- a/template/crystal/Dockerfile +++ /dev/null @@ -1,33 +0,0 @@ -FROM --platform=${TARGETPLATFORM:-linux/amd64} ghcr.io/openfaas/of-watchdog:0.9.10 as watchdog -FROM --platform=${TARGETPLATFORM:-linux/amd64} alpine as build - -RUN apk update && apk upgrade -RUN apk add crystal shards -RUN apk cache clean -WORKDIR /home/app -COPY . . - -COPY function/shard.yml shard.yml -RUN shards install -RUN crystal build main.cr -o handler --release --static -RUN strip handler - -FROM --platform=${TARGETPLATFORM:-linux/amd64} alpine as ship -RUN apk update && apk upgrade && apk cache clean -# Add non root user -# Add non root user -RUN addgroup -S app && adduser app -S -G app - -WORKDIR /home/app -USER app - -COPY --from=build /home/app/function/ . -COPY --from=build /home/app/handler . -COPY --from=watchdog /fwatchdog /home/app/fwatchdog - -ENV fprocess="./handler" -EXPOSE 8080 - -HEALTHCHECK --interval=2s CMD [ -e /tmp/.lock ] || exit 1 - -CMD ["./fwatchdog"] diff --git a/template/crystal/function/handler.cr b/template/crystal/function/handler.cr deleted file mode 100644 index d8af919..0000000 --- a/template/crystal/function/handler.cr +++ /dev/null @@ -1,7 +0,0 @@ -require "json" - -class Handler - def run(req : String) - return JSON::Any.new("Hello, Crystal. You said: #{req}") - end -end diff --git a/template/crystal/function/shard.yml b/template/crystal/function/shard.yml deleted file mode 100644 index 76711f4..0000000 --- a/template/crystal/function/shard.yml +++ /dev/null @@ -1,7 +0,0 @@ -name: crystal_faas_function -version: 0.1.0 - -# dependencies: -# pg: -# github: will/crystal-pg -# version: "~> 0.5" diff --git a/template/crystal/main.cr b/template/crystal/main.cr deleted file mode 100644 index 4e053fc..0000000 --- a/template/crystal/main.cr +++ /dev/null @@ -1,11 +0,0 @@ -# Copyright (c) Thomas Peikert 2018. All rights reserved. -# Licensed under the MIT license. See LICENSE file in the project root for full license information. - -require "json" -require "./function/handler" - -req = STDIN.gets_to_end -handler = Handler.new -res = handler.run req - -puts res diff --git a/template/crystal/template.yml b/template/crystal/template.yml deleted file mode 100644 index c55c3f6..0000000 --- a/template/crystal/template.yml +++ /dev/null @@ -1,6 +0,0 @@ -language: crystal -fprocess: ./handler -welcome_message: | - You have created a new function which uses crystal 1.7.3 🎉 - To include third-party dependencies, use a vendoring tool like shards: - shards documentation: https://github.com/crystal-lang/shards