Skip to content

Commit fa69acf

Browse files
committed
get ruby working a bit better
1 parent 531bcce commit fa69acf

2 files changed

Lines changed: 32 additions & 27 deletions

File tree

‎v4-cokapi/Dockerfile‎

Lines changed: 29 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -15,16 +15,40 @@ MAINTAINER Philip Guo <philip@pgbovine.net>
1515
# http://stackoverflow.com/questions/24991136/docker-build-could-not-resolve-archive-ubuntu-com-apt-get-fails-to-install-a
1616
# Uncomment the following line in /etc/default/docker DOCKER_OPTS="--dns 8.8.8.8 --dns 8.8.4.4"
1717
# Restart the Docker service sudo service docker restart
18+
#
19+
# lots of packages required especially to build ruby and to use the compiled version of 'gem'
1820
RUN apt-get update && apt-get install -y \
1921
nodejs \
2022
openjdk-7-jdk \
21-
python
23+
python \
24+
build-essential \
25+
zlibc \
26+
zlib1g \
27+
zlib1g-dev \
28+
libssl-dev
29+
2230

2331
# ugh ubuntu calls node 'nodejs'
2432
RUN ln -s /usr/bin/nodejs /usr/bin/node
2533

2634

27-
# Java backend (put first in Dockerfile since it doesn't change as
35+
# Ruby backend: pretty complex setup since we need to compile and
36+
# install a custom Ruby interpreter
37+
#
38+
# run all of this stuff early so that we don't invalidate the cache
39+
RUN mkdir /tmp/ruby
40+
# automatically untars
41+
ADD backends/ruby/custom-ruby-interpreter/ruby-2.2.2.tar.gz /tmp/ruby
42+
ADD backends/ruby/custom-ruby-interpreter/altered-files /tmp/ruby/ruby-2.2.2
43+
RUN mkdir /tmp/ruby/ruby-2.2.2-custom-OPT/
44+
RUN cd /tmp/ruby/ruby-2.2.2 && ./configure --prefix=/tmp/ruby/ruby-2.2.2-custom-OPT/
45+
# beware takes a long time! so make sure we cache the build
46+
RUN cd /tmp/ruby/ruby-2.2.2 && make && make install
47+
# install custom gem
48+
RUN /tmp/ruby/ruby-2.2.2-custom-OPT/bin/gem install debug_inspector
49+
50+
51+
# Java backend (put early in Dockerfile since it doesn't change as
2852
# frequently and takes longer to build)
2953
RUN mkdir /tmp/java_jail
3054
RUN mkdir /tmp/java_jail/cp
@@ -47,31 +71,8 @@ ADD backends/python /tmp/python
4771
COPY backends/java/run-java-backend.sh /tmp/
4872
RUN chmod a+x /tmp/run-java-backend.sh
4973

50-
RUN useradd netuser
51-
52-
53-
# Ruby backend: pretty complex setup since we need to compile and
54-
# install a custom Ruby interpreter
55-
56-
# lots of packages required to build ruby and to use the compiled version of 'gem'
57-
RUN apt-get update && apt-get install -y \
58-
build-essential \
59-
zlibc \
60-
zlib1g \
61-
zlib1g-dev \
62-
libssl-dev
63-
64-
RUN mkdir /tmp/ruby
65-
# automatically untars
66-
ADD backends/ruby/custom-ruby-interpreter/ruby-2.2.2.tar.gz /tmp/ruby
67-
ADD backends/ruby/custom-ruby-interpreter/altered-files /tmp/ruby/ruby-2.2.2
68-
RUN mkdir /tmp/ruby/ruby-2.2.2-custom-OPT/
69-
RUN cd /tmp/ruby/ruby-2.2.2 && ./configure --prefix=/tmp/ruby/ruby-2.2.2-custom-OPT/
70-
# beware takes a long time! so make sure we cache the build
71-
RUN cd /tmp/ruby/ruby-2.2.2 && make && make install
72-
# install custom gem
73-
RUN /tmp/ruby/ruby-2.2.2-custom-OPT/bin/gem install debug_inspector
7474

75+
# Ruby backend
7576
COPY backends/ruby/pg_logger.rb /tmp/ruby/
7677

7778
# To properly run tests, become root:
@@ -80,3 +81,5 @@ COPY backends/ruby/golden_test.py /tmp/ruby/
8081
RUN mkdir /tmp/ruby/tests
8182
ADD backends/ruby/tests /tmp/ruby/tests
8283
RUN cd /tmp/ruby && ln -s ruby-2.2.2-custom-OPT/bin/ruby
84+
85+
RUN useradd netuser

‎v4-cokapi/backends/java/run-java-backend.sh‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@
88
# tricky! use a heredoc to pipe the $1 argument into the stdin of the
99
# java executable WITHOUT interpreting escape chars such as '\n' ...
1010
# echo doesn't work here since it interprets '\n' and other chars
11-
cat <<ENDEND | java -Xmx512m -cp /tmp/java_jail/cp:/tmp/java_jail/cp/javax.json-1.0.jar:/usr/lib/jvm/java-7-openjdk-amd64/lib/tools.jar:/tmp/java_jail/cp/visualizer-stdlib traceprinter.InMemory
11+
#
12+
# TODO: use -Xmx512m if we need more memory
13+
cat <<ENDEND | java -Xmx384m -cp /tmp/java_jail/cp:/tmp/java_jail/cp/javax.json-1.0.jar:/usr/lib/jvm/java-7-openjdk-amd64/lib/tools.jar:/tmp/java_jail/cp/visualizer-stdlib traceprinter.InMemory
1214
$1
1315
ENDEND

0 commit comments

Comments
 (0)