Sign inSign up

eshan04dev/ve-compiler-container

By eshan04dev

•Updated almost 2 years ago

Multi-language code compiler container (C, C++, Python, Java, JS, Rust, Lua, Go) with API support.

Image
1

10K+

eshan04dev/ve-compiler-container repository overview

⁠VE Compiler Container

⁠Overview

This Docker container is designed to run a variety of compilers including C, C++, Python, Java, JavaScript, Rust, Lua and Go. It also includes a custom server built using Node.js and Express, which allows you to compile code via an HTTP API.

The VE Compiler 2.0 is included to handle the compilation of code, and the container exposes an API to compile code in multiple languages.

⁠Features

  • Supports multiple programming languages: C, C++, Python, Java, JavaScript, Rust, Lua, Go.
  • API for compiling code via HTTP requests.
  • Simple to set up and use with Docker.
  • Built with Node.js, Express, and VE Compiler 2.0.

⁠How to Use

⁠1. Build the Docker Container

To build the Docker image, run the following command in the root directory of your project (where the Dockerfile is located):

docker build -t eshan04dev/ve-compiler-container .
⁠2. Run the Docker Container

Once the image is built, you can run the container with the following command:

docker run -p 4000:4000 eshan04dev/ve-compiler-container

This will run the container and expose the server on port 4000.

⁠3. Access the API

The container exposes the following HTTP endpoints:

  • POST /compile-code: Use this endpoint to compile code by sending a JSON request with the code and language.

    Example request:

    {
      "code": "print('Hello, world!')",
      "language": "py"
    }
    

    Example response:

    {
      "output": "Hello, world!"
    }
    
  • GET /health: Use this endpoint to check if the server is running. It returns a 200 OK status with a timestamp.

    Example response:

    {
      "status": "server is running",
      "timestamp": "2024-12-25T12:34:56Z"
    }
    

⁠Installation

⁠1. Install Docker

Ensure Docker is installed on your machine. You can download Docker from here⁠.

⁠2. Pull the Image from Docker Hub

If you don't want to build the image yourself, you can pull the pre-built image from Docker Hub:

docker pull eshan04dev/ve-compiler-container
⁠3. Run the Container

Run the pulled image:

docker run -p 4000:4000 eshan04dev/ve-compiler-container

Tag summary

Content type

Image

Digest

sha256:75b5865fd…

Size

399.7 MB

Last updated

almost 2 years ago

docker pull eshan04dev/ve-compiler-container