0

I am trying to build a code evaluation service for online judge.

  • It will get C++ code along with some problemId.
  • Then we fetch test cases, judging code, time and memory limits against the give problemId.
  • Finally we run the code, the run the judge against the received output to evaluate the verdict - TLE,MLE, etc.

To do this currently I am thinking to spin up docker container with fixed CPU time and memory limit and then run the code inside of it. But there are some problems:

  1. How to read the test case and answer inside the container?

  2. How to create image with preinstalled compiler to run c++ code?

  3. How to determine the maximum number of docker container that should be running concurrently?

  4. Should the evaluation code run in the same container as the original code ran.

  5. Finally is there a better approach than docker for this objective?

I am just going through docker client documentation. https://pkg.go.dev/github.com/docker/docker/client

Sahil
  • 39
  • 2
  • Check out the [gcc image](https://hub.docker.com/_/gcc). However, you might want to compile your code separately, then have a bunch of other containers which run your code. This way, you can run your tests in the command line (using Go or whatever) and record the Stdout. – ben10mexican Feb 18 '23 at 01:35

0 Answers0