Run the application codes for multiple languages using very simple APIs.
Remote code execution application creates a container then executes the code gives the response to client. Current architecture does not use DIND(Docker in Docker). The containers share the same docker daemon.

Follow the getting started steps to run the application.
make upFirst change the mount source path in dev.yml and local.yml files.
Source path should be pointing to the path of /target folder in your application. You can use the bash command below if you're inside the application directory with the terminal.
source_path="$(pwd)/target"
echo $source_path
mounts:
- type: "bind"
source: <source_path> # write the value here
target: "/app"
Build the all-in-one-ubuntu image
docker build build/all-in-one-ubuntu -t all-in-one-ubuntu
APP_ENV=local go run . serve
Build the rce image
docker build --progress=plain -t rce -f dev.Dockerfile .
Run the container with the image you have created before.
docker run -it -p 8888:8888 -v /var/run/docker.sock:/var/run/docker.sock --mount type=bind,source=$(pwd)/target,target=/rce/target rce
Build the ubuntu docker image to run code with different languages.
docker build build/all-in-one-ubuntu -t all-in-one-ubuntu
docker run -dit all-in-one-ubuntu
Open ubuntu container from command line.
docker ps # find the container id
docker exec -it <container-id> bash
Test the compiler/interpreters.
python3 --versionjava -versionjavac -versionnodejs --version/usr/local/go/bin/go versiong++ --versiongcc --versionThe command below will work for ubuntu container. You need to change the bash command according to container you use. For example for alpine container it should be /bin/sh.
docker exec -w <workdir> -it <container-id> bash -c "<command> && <command>"
Clone the application, open the terminal and go to the application directory then run the commands below.
mkdir target
echo 'import package
import "fmt"
func main() {
fmt.Println("Hello, world!")
}' > demo.go
go build -o rce .
APP_ENV=local ./rce exec -p demo.go -l golang
To kill the container and remove after that.
function conkill {
docker kill $1
docker container rm $1
}
conkill <container-id>
Content type
Image
Digest
Size
10.8 MB
Last updated
almost 5 years ago
docker pull bilginyuksel/rce