Skip to content

qxxiao/sandbox

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

simple-docker-sandbox

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

  1. 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
  1. 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

Modify & Notes

you can add your language env in setup/Dockfile, and rebuild your image.

notes

  1. docker-sandbox
docker-sandbox/payload --- run scripts
docker-sandbox/temp    --- temp compile/run working-dir
other-files            --- js demo 
  1. compilers.js you must define a compilerArray in your app, and it will be use for compiling source code and run.

credits

https://github.com/remoteinterview/compilebox