CompileBox is a Docker based sandbox to run untrusted code and return the output to your app. Users can submit their code in any of the supported languages. The system will test the code in an isolated environment.
- use pre-built docker image
If docker is not installed, run script and install docker and pull image:
./install.sh
or you can just pull this image:
docker pull qxxiao/compile-sandbox:latest
- run example
cd docker-sandbox
npm install && node app.js
If everything has been setup correctly in app.js file, you will see the following message on your terminal:
Listening at 8080
- navigate your browser to http://127.0.0.1:8080/
- Try: Js demo
you can add your language env in setup/Dockfile, and rebuild your image.
- docker-sandbox
docker-sandbox/payload --- run scripts
docker-sandbox/temp --- temp compile/run working-dir
other-files --- js demo
- compilers.js you must define a compilerArray in your app, and it will be use for compiling source code and run.