Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions dev-requirements.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
pytest
pytest-asyncio
pyyaml
httpx
starlette
aiodocker
5 changes: 5 additions & 0 deletions livecode_server/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,11 @@
"command": [],
"code_filename": "main.py"
},
"javascript": {
"image": "frappedevs/falcon-javascript:latest",
"command": [],
"code_filename": "main.js"
},
"rust": {
"image": "fossunited/falcon-rust",
"command": [],
Expand Down
7 changes: 7 additions & 0 deletions runtimes/javascript/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
FROM node:18
WORKDIR /app
RUN mkdir -p /opt/modes
COPY run.sh /opt/
COPY modes/exec.sh /opt/modes/
RUN chmod +x /opt/run.sh /opt/modes/exec.sh
ENTRYPOINT ["/opt/run.sh"]
3 changes: 3 additions & 0 deletions runtimes/javascript/modes/exec.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/bin/sh
SOURCE_FILE=${FALCON_SOURCE_FILE:-"main.js"}
node "$SOURCE_FILE"
12 changes: 12 additions & 0 deletions runtimes/javascript/run.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#! /bin/sh
TIMEOUT=10
SOURCE_FILE=${FALCON_SOURCE_FILE:-"main.js"}
MODE=${FALCON_MODE:-"exec"}
SCRIPT=/opt/modes/$MODE.sh

if [ -x "$SCRIPT" ]; then
exec timeout $TIMEOUT $SCRIPT "$@"
else
echo "ERROR: invalid mode - $MODE" 1>&2
exit 1
fi
3 changes: 3 additions & 0 deletions tests/runtimes/test_javascript_hello.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
runtime: javascript
code: console.log("hello, world!")
expected_output: "hello, world!\n"
Loading