Skip to content

Commit dd15325

Browse files
Merge pull request #2 from ankurg22/patch-1
Added py3 worker
2 parents 12d355f + 6b93262 commit dd15325

File tree

10 files changed

+48
-0
lines changed

10 files changed

+48
-0
lines changed

containers/py3/Dockerfile

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
FROM alpine:3.6
2+
3+
RUN apk add --no-cache python3 bash
4+
COPY ./compile.sh /bin/compile.sh
5+
COPY ./run.sh /bin/run.sh
6+
RUN chmod 777 /bin/compile.sh; \
7+
chmod 777 /bin/run.sh

containers/py3/compile.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
#!/usr/bin/env bash

containers/py3/run.sh

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
#!/usr/bin/env bash
2+
3+
python3 script.py < run.stdin 1> run.stdout 2> run.stderr

tests/py3/run.stdin

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
World

tests/py3/runbox/run.stderr

Whitespace-only changes.

tests/py3/runbox/run.stdin

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
World

tests/py3/runbox/run.stdout

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Hello World

tests/py3/runbox/script.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
inp = input()
2+
print("Hello " + inp)

tests/py3/script.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
inp = input()
2+
print("Hello " + inp)

tests/py3/test_worker.sh

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
#!/usr/bin/env bash
2+
pushd $(dirname "$0")
3+
DIR=$(pwd)
4+
RUNBOX="${DIR}/runbox"
5+
6+
echo $RUNBOX
7+
# Remove RUNBOX
8+
rm -rf $RUNBOX
9+
10+
# Create runbox
11+
mkdir -p $RUNBOX
12+
13+
# Copy source to runbox
14+
cp $DIR/script.py $RUNBOX/script.py
15+
cp $DIR/run.stdin $RUNBOX/run.stdin
16+
17+
# Test Compile
18+
docker run \
19+
--cpus="0.5" \
20+
--memory="20m" \
21+
--ulimit nofile=64:64 \
22+
--rm \
23+
--read-only \
24+
-v "$RUNBOX":/usr/src/runbox \
25+
-w /usr/src/runbox codingblocks/judge-worker-py3 \
26+
bash -c "/bin/compile.sh && /bin/run.sh"
27+
28+
29+
# Delete runbox
30+
#rm -rf $RUNBOX

0 commit comments

Comments
 (0)