add new executors

This commit is contained in:
Brian Seymour 2018-09-22 01:11:53 -05:00
parent 9e0c0c40f5
commit 087a6e6a39
6 changed files with 33 additions and 2 deletions

View File

@ -1,13 +1,22 @@
FROM ubuntu:18.04 FROM ubuntu:18.04
RUN sed -i 's/http:\/\/archive.ubuntu.com\/ubuntu\//http:\/\/mirror.math.princeton.edu\/pub\/ubuntu\//' /etc/apt/sources.list
RUN apt-get update RUN apt-get update
RUN apt-get -y install bash-completion RUN echo "tzdata tzdata/Areas select America" > /tmp/tzseed.txt; \
echo "tzdata tzdata/Zones/America select Chicago" >> /tmp/tzseed.txt; \
debconf-set-selections /tmp/tzseed.txt && \
apt-get install -y tzdata && \
rm /tmp/tzseed.txt
RUN apt-get -y install nano dpkg-dev
RUN apt-get -y install build-essential RUN apt-get -y install build-essential
RUN apt-get -y install python RUN apt-get -y install python
RUN apt-get -y install python3 RUN apt-get -y install python3
RUN apt-get -y install ruby RUN apt-get -y install ruby
RUN apt-get -y install nodejs RUN apt-get -y install nodejs
RUN apt-get -y install golang RUN apt-get -y install golang
RUN apt-get -y install php7.2
RUN apt-get -y install r-base
RUN apt-get -y install mono-complete
RUN useradd -m runner RUN useradd -m runner

View File

@ -38,6 +38,15 @@ case "$lang" in
"go") "go")
bin=executor_go bin=executor_go
;; ;;
"c#" | "csharp" | "cs")
bin=executor_csharp
;;
"r")
bin=executor_r
;;
"php")
bin=executor_php
;;
*) *)
echo "invalid language" echo "invalid language"
exit exit
@ -56,6 +65,9 @@ docker run \
-v $dir/executors/c:/executor_c:ro \ -v $dir/executors/c:/executor_c:ro \
-v $dir/executors/cpp:/executor_cpp:ro \ -v $dir/executors/cpp:/executor_cpp:ro \
-v $dir/executors/go:/executor_go:ro \ -v $dir/executors/go:/executor_go:ro \
-v $dir/executors/csharp:/executor_csharp:ro \
-v $dir/executors/r:/executor_r:ro \
-v $dir/executors/php:/executor_php:ro \
piston \ piston \
runuser \ runuser \
-l runner \ -l runner \

4
docker/executors/csharp Normal file
View File

@ -0,0 +1,4 @@
#!/bin/sh
mcs $1 -out:binary
timeout -s KILL 3 mono binary

3
docker/executors/php Normal file
View File

@ -0,0 +1,3 @@
#!/bin/sh
timeout -s KILL 3 php $*

3
docker/executors/r Normal file
View File

@ -0,0 +1,3 @@
#!/bin/sh
timeout -s KILL 3 Rscript $*

View File

@ -13,7 +13,7 @@ from from EMKC contests and challenges. It's also used in the Engineer Man Disco
- `docker/execute <lang> <path to file>` - `docker/execute <lang> <path to file>`
#### Supported Languages #### Supported Languages
Currently python2, python3, c, c++, go, node, and ruby are supported. Currently python2, python3, c, c++, go, node, ruby, r, c#, and php are supported.
#### Principle of Operation #### Principle of Operation
Piston utilizes Docker as the primary mechanism for sandboxing. There is a small API written in Go which takes Piston utilizes Docker as the primary mechanism for sandboxing. There is a small API written in Go which takes