diff --git a/docker/Dockerfile b/docker/Dockerfile index 2ef67e2..053d00b 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -1,13 +1,22 @@ 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 -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 python RUN apt-get -y install python3 RUN apt-get -y install ruby RUN apt-get -y install nodejs 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 diff --git a/docker/execute b/docker/execute index f4dd47a..7a32954 100755 --- a/docker/execute +++ b/docker/execute @@ -38,6 +38,15 @@ case "$lang" in "go") bin=executor_go ;; +"c#" | "csharp" | "cs") + bin=executor_csharp + ;; +"r") + bin=executor_r + ;; +"php") + bin=executor_php + ;; *) echo "invalid language" exit @@ -56,6 +65,9 @@ docker run \ -v $dir/executors/c:/executor_c:ro \ -v $dir/executors/cpp:/executor_cpp: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 \ runuser \ -l runner \ diff --git a/docker/executors/csharp b/docker/executors/csharp new file mode 100644 index 0000000..224385c --- /dev/null +++ b/docker/executors/csharp @@ -0,0 +1,4 @@ +#!/bin/sh + +mcs $1 -out:binary +timeout -s KILL 3 mono binary diff --git a/docker/executors/php b/docker/executors/php new file mode 100644 index 0000000..8279379 --- /dev/null +++ b/docker/executors/php @@ -0,0 +1,3 @@ +#!/bin/sh + +timeout -s KILL 3 php $* diff --git a/docker/executors/r b/docker/executors/r new file mode 100644 index 0000000..fb7f288 --- /dev/null +++ b/docker/executors/r @@ -0,0 +1,3 @@ +#!/bin/sh + +timeout -s KILL 3 Rscript $* diff --git a/readme.md b/readme.md index 52be84a..488ef83 100644 --- a/readme.md +++ b/readme.md @@ -13,7 +13,7 @@ from from EMKC contests and challenges. It's also used in the Engineer Man Disco - `docker/execute ` #### 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 Piston utilizes Docker as the primary mechanism for sandboxing. There is a small API written in Go which takes