Arbitrary code execution server using Docker
274
Arbitrary code execution server using Docker.
Each language has its own Docker image and so each evaluation will run in the respective language's locked-down container.
Features include:
Requires Docker 18+ to operate.
Check the Releases tab for pre-built binaries.
The languages folder and an example configuration are also included.
You can use either stack or cabal.
stack should be >= 2.1.1, cabal should be >= 2.4.0.0.stack or if using cabal.Make sure the place where stack or cabal places binaries is in your PATH.
stack, you can get it with stack path --local-bin.cabal, you should find it in $HOME/.cabal/bin (Linux) or %APPDATA%\cabal\bin (Windows).Run stack install or cabal new-install inside the project folder.
Or, to build within the project, run stack build or cabal new-build.
Make sure the configuration is filled out, see config.example.yaml for an example.
Run myriad (or stack run or cabal new-run if you built within the project) to start the server.
The config and languages folder will default to ./config.yaml and ./languages.
You can configure this with --config and --languages.
/languagesList of enabled languages.
Example response:
["haskell", "javascript"]
/evalEvaluate code.
JSON payload with language and code keys.
The language is as in the name of a subfolder in the languages directory.
Example payload:
{ "language": "haskell", "code": "main = print (1 + 1)" }
Example response:
{ "result": "2\n" }
Errors with 404 if language is not found, 504 if evaluation timed out, or 500 if evaluation failed for other reasons.
/containersList of containers being handled by Myriad.
/cleanupKill all containers, giving back the names of the containers killed.
Content type
Image
Digest
Size
29.1 MB
Last updated
over 5 years ago
docker pull sunred/myriad