-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
22 changed files
with
108 additions
and
37 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
{:linters | ||
{:redefined-var {:level :off} | ||
:duplicate-require {:level :off} | ||
:namespace-name-mismatch {:level :off}}} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
(ns function.handler) | ||
|
||
(defn handler [{:keys [body]}] | ||
{:body (str "Hello, " (slurp body))}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
{:paths ["."]} |
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
FROM ghcr.io/openfaas/of-watchdog:0.9.11 AS watchdog | ||
FROM babashka/babashka:1.3.176 AS babashka | ||
FROM clojure:tools-deps-1.11.1.1257 | ||
|
||
RUN set -e | ||
|
||
COPY --from=watchdog /fwatchdog /usr/bin/fwatchdog | ||
COPY --from=babashka /usr/local/bin/bb /usr/local/bin/bb | ||
|
||
ENV HOME /home/app | ||
|
||
RUN addgroup --system app && adduser --system --ingroup app app && \ | ||
mkdir -p $HOME/.deps.clj/1.11.1.1257/ClojureTools && \ | ||
mv /root/.m2 $HOME && \ | ||
chown app:app -R $HOME/.m2 && \ | ||
mv /usr/local/lib/clojure/libexec/clojure-tools-1.11.1.1257.jar $HOME/.deps.clj/1.11.1.1257/ClojureTools | ||
|
||
USER app | ||
WORKDIR $HOME | ||
|
||
COPY index.clj function/bb.edn ./ | ||
COPY function function | ||
|
||
RUN bb prepare | ||
|
||
HEALTHCHECK --interval=2s CMD [ -e /tmp/.lock ] || exit 1 | ||
CMD ["fwatchdog"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
{:paths ["."]} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
(ns function.handler) | ||
|
||
(defn handler [s] s) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
#!/usr/bin/env bb | ||
|
||
(require '[function.handler :as function]) | ||
|
||
(defn read-lines | ||
([] (read-lines "")) | ||
([acc] (if-let [line (read-line)] | ||
(recur (str acc line)) | ||
acc))) | ||
|
||
(defn main [] | ||
(let [input (read-lines) | ||
output (function/handler input)] | ||
(println output))) | ||
|
||
(main) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
language: bb-streaming | ||
fprocess: ./index.clj | ||
welcome_message: | | ||
You have created a new Function which uses Babashka |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
(ns function.handler) | ||
|
||
(defn handler [s] s) | ||
(defn handler [{:keys [body]}] | ||
{:body body}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,9 @@ | ||
#!/usr/bin/env bb | ||
|
||
(require '[function.handler :as function]) | ||
(require | ||
'[function.handler :as function] | ||
'[org.httpkit.server :refer [run-server]]) | ||
|
||
(defn read-lines | ||
([] (read-lines "")) | ||
([acc] (if-let [line (read-line)] | ||
(recur (str acc line)) | ||
acc))) | ||
(run-server function/handler {:port 8082}) | ||
|
||
(defn main [] | ||
(let [input (read-lines) | ||
output (function/handler input)] | ||
(println output))) | ||
|
||
(main) | ||
@(promise) |