The project is a Docker-based environment for executing code snippets in multiple programming languages, including Python, JavaScript, TypeScript, Java, C++, and Go. This tool is particularly useful for educational purposes, coding assessments, and automated testing environments, providing a simple and isolated execution space.
- Support for multiple programming languages.
- Docker-based execution environment for code isolation.
- Environment variable configuration for easy customization.
- Execution time and memory limit controls.
Before you begin, ensure you have the following installed on your system:
- Docker
- Go (for running the Go-based server and utility scripts)
- Clone the repository:
git clone https://github.com/seymuromarov/go-sandbox.git
cd go-sandbox
go get- Load Environment Variables:
Place a
.envfile in the root directory with the necessary configuration parameters. Refer to .env.example for guidance on the required settings.
To run a code snippet, use the following command format:
go run . <language extension> <file path>For example, to run a Go file located at ./examples/fibonacci.go, you would use:
go run . .go ./examples/fibonacci.goPlease note that the first run will take additional time due to the Docker image being built.
To add support for a new programming language, follow these steps:
- Update Dockerfile:
Ensure the Docker image has the necessary compilers or interpreters for the new language.
- Modify
dockerutils/config.go:
Add a new case in the GetDockerCommand function to handle the new language extension and define the command to compile/run the code.