Skip to content

YoungLeeTAMUSA/RemoteCodeCompiler

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

120 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Build and Test Docker MIT license Test Coverage

Remote Code Compiler

An online code compiler for Java, C, C++ and Python for competitive programming and coding interviews. This service execute your code remotely using docker containers to separate the different environements of executions.

Prerequisites

To run this project you need a docker engine running on your machine.

Getting Started

Build docker image by typing the following command :

docker image build . -t compiler

Run the container by typing the following command

docker container run -p 8080:8082 -v /var/run/docker.sock:/var/run/docker.sock -t compiler

Now your server is listening on the port 8080.

Portainer

It might be a good idea if you run a Portainer instance and bind it to the same volume, in order to have a total view of created images and running containers.

docker container run -p 9000:9000 -v /var/run/docker.sock:/var/run/docker.sock portainer/portainer

How It Works

Architecture

There is four endpoints, one for Java, one for C, one for C ++ and another for Python. The call is done through POST requests to the following urls :

  • localhost:8080/compiler/java
  • localhost:8080/compiler/c
  • localhost:8080/compiler/cpp
  • localhost:8080/compiler/python

For the documentation visit the swagger page at the following url : http://localhost:8080/swagger-ui.html

Compilers endpoints

Visualize Docker images and containers info

It is also possible to visualize information about the images and docker containers that are currently running using these endpoints

Docker info

Example of an Output

Docker Containers

Docker info response

Docker Images

Docker images info

How the docker image is generated

We generate an entrypoint.sh file depending on the information given by the user (time limit, memory limit, programming language, and also the inputs).

Alt text

Metrics

Check out exposed prometheus metrics using the following url : http://localhost:8080/actuator/prometheus

Author

About

An online code compiler using Java and Docker for Java, C, C++, and Python for competitive programming and coding interviews

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages

  • Java 96.9%
  • Dockerfile 2.7%
  • Shell 0.4%