Skip to content

Commit

Permalink
Use judge0/api-base:0.3.0 that has new isolate. Remove stderr.txt fro…
Browse files Browse the repository at this point in the history
…m sandbox.
  • Loading branch information
hermanzdosilovic committed Feb 15, 2019
1 parent 1f135c1 commit 350ff3a
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 14 deletions.
19 changes: 10 additions & 9 deletions Dockerfile
@@ -1,20 +1,21 @@
FROM judge0/api-base:0.2.1
FROM judge0/api-base:0.3.0

RUN apt-get update && \
apt-get install -y \
apt-get install --no-install-recommends -y \
libpq-dev \
nodejs-legacy \
npm \
sudo
sudo && \
rm -rf /var/lib/apt/lists/*

ENV PATH "/usr/local/ruby-2.3.3/bin:/opt/.gem/bin:$PATH"
ENV GEM_HOME "/opt/.gem/"
RUN echo "gem: --no-document" > /root/.gemrc && \
gem install \
rails:5.0 \
bundler \
pg && \
npm install -g aglio
rails:5.0.0 \
bundler:1.15.4 \
pg:0.18 && \
npm install -g aglio@2.3.0

EXPOSE 3000

Expand All @@ -30,5 +31,5 @@ CMD rm -f tmp/pids/server.pid && \
rails db:create db:migrate db:seed && \
rails s -b 0.0.0.0

LABEL maintainer="Herman Zvonimir Došilović, hermanz.dosilovic@gmail.com" \
version="1.1.1"
LABEL maintainer="Herman Zvonimir Došilović, hermanz.dosilovic@gmail.com"
LABEL version="1.1.1"
9 changes: 4 additions & 5 deletions app/jobs/isolate_job.rb
Expand Up @@ -51,12 +51,12 @@ def init
@source = box + submission.language.source_file
@stdin = workdir + "/" + STDIN_FILE
@stdout = workdir + "/" + STDOUT_FILE
@stderr = box + STDERR_FILE
@stderr = workdir + "/" + STDERR_FILE
@meta = workdir + "/" + META_FILE
end

def write
[stdin, stdout, meta].each do |f|
[stdin, stdout, stderr, meta].each do |f|
`sudo touch #{f} && sudo chown $(whoami): #{f}`
end

Expand Down Expand Up @@ -86,7 +86,6 @@ def compile
def run
command = "isolate #{cgroups} \
-s \
-r #{STDERR_FILE} \
-b #{id} \
-M #{meta} \
-t #{submission.cpu_time_limit} \
Expand All @@ -95,13 +94,13 @@ def run
-k #{submission.stack_limit} \
-p#{submission.max_processes_and_or_threads} \
#{submission.enable_per_process_and_thread_memory_limit ? "--cg-mem=" : "-m "}#{submission.memory_limit} \
#{submission.enable_per_process_and_thread_time_limit ? "--cg-timing" : ""} \
#{submission.enable_per_process_and_thread_time_limit ? "--cg-timing" : "--no-cg-timing"} \
-f #{submission.max_file_size} \
-E HOME=#{workdir} \
-d '/etc':'noexec' \
--run \
-- #{submission.language.run_cmd} \
< #{stdin} > #{stdout} \
< #{stdin} > #{stdout} 2> #{stderr} \
"

puts "[#{DateTime.now}] Running submission #{submission.token} (#{submission.id}):"
Expand Down

0 comments on commit 350ff3a

Please sign in to comment.