CppRunner is a simple Web API that can run C++ code for you. It's based on .NET and Docker.
Try a running CppRunner here.
The following script will install\update this app on your Ubuntu server. Supports Ubuntu 22.04.
On your Ubuntu server, run the following command:
curl -sL https://gitlab.aiursoft.cn/aiursoft/cpprunner/-/raw/master/install.sh | sudo bash
Of course it is suggested that append a custom port number to the command:
curl -sL https://gitlab.aiursoft.cn/aiursoft/cpprunner/-/raw/master/install.sh | sudo bash -s 8080
It will install the app as a systemd service, and start it automatically. Binary files will be located at /opt/apps
. Service files will be located at /etc/systemd/system
.
Requirements about how to run
- Install Docker
- Install .NET 8 SDK and Node.js.
- Configure
www-data
user in your host machine to allow access to Docker with:sudo usermod -aG docker www-data
- Add
www-data
home:sudo mkdir /var/www && sudo chown www-data:www-data /var/www
- Run
npm install
insrc/Aiursoft.CppRunner.FrontEnd
folder. - Run
npm run build
insrc/Aiursoft.CppRunner.FrontEnd
folder. - Copy
src/Aiursoft.CppRunner.FrontEnd/dist
folder tosrc/Aiursoft.CppRunner/wwwroot
folder. - Execute
sudo -u www-data dotnet run
as www-data user in the project path. - Use your browser to view http://localhost:5000.
First, install Docker here.
Then run the following commands in a Linux shell:
mkdir -p /tmp/cpprunner/builds
image=hub.aiursoft.cn/aiursoft/cpprunner
appName=cpprunner
docker pull $image
docker run -d --name $appName --restart unless-stopped -p 5000:5000 -v /var/www/$appName:/data -v /tmp/cpprunner/builds:/tmp/cpprunner/builds -v /var/run/docker.sock:/var/run/docker.sock $image
That will start a web server at http://localhost:5000
and you can test the app.
The docker image has the following context:
Properties | Value |
---|---|
Image | hub.aiursoft.cn/aiursoft/moongladepure |
Ports | 5000 |
Binary path | /app |
Data path | /data |
Config path | /data/appsettings.json |
Passthrough | /var/run/docker.sock (For Docker) |
Passthrough | /tmp/cpprunner/builds (For code) |
- Open the
.sln
file in the project path. - Press
F5
to run the app.
There are many ways to contribute to the project: logging bugs, submitting pull requests, reporting issues, and creating suggestions.
Even if you with push rights on the repository, you should create a personal fork and create feature branches there when you need them. This keeps the main repository clean and your workflow cruft out of sight.
We're also interested in your feedback on the future of this project. You can submit a suggestion or feature request through the issue tracker. To make this process more effective, we're asking that these include more information to help define them more clearly.