Code Runner uses Docker as sandboxing environment
To use CodeRunner package, it requires the following dependencies to be installed:
Docker: 1.11.2
Docker-machine: 0.7.0
python 2.7.11
Guide to set up for Ubuntu 14.04.4 LTS, but for other Ubuntu version, it should also work properly
Install python 2.7.11
python 2.7.11
Clone master branch of this repository for the latest version of Code-Runner
git clone --depth=50 --branch=master https://github.com/nguyenhoangson/Code-Runner.git
cd Code-Runner
Change mode for set up scripts and run them to set up
chmod 755 ./scripts/*
./scripts/install_docker
./scripts/install_docker_machine
pip install -r requirements.txt
Finally run example.py file to see if everything is set up properly
python example.py
Click here to see how the steps above are actually run in Ubuntu 14.04.4 LTS environment
After completing setup above, Code-Runner can be used as a normal Python package
Import C Compiler
from CodeRunner.C.Compiler import Compiler
Invoke class Compiler
c = Compiler()
Compile .c file by specifying its path and desired folder for executable file. Note that executable file will be stored in local computer
c.compile("./test.c", "./test")
Run executable file in sandboxing (probably remote) Docker environment
c.run("./test")