Skip to content

Commit

Permalink
Add ruby
Browse files Browse the repository at this point in the history
  • Loading branch information
JRaspass committed May 8, 2017
1 parent 9cfd674 commit 8029a96
Show file tree
Hide file tree
Showing 6 changed files with 177 additions and 1 deletion.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
/app
/containers/perl/rootfs/
/containers/*/rootfs/
/static.go
17 changes: 17 additions & 0 deletions build-langs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

docker pull alpine:edge

# Perl
cd containers/perl

docker build -t perl-build .
Expand All @@ -19,3 +20,19 @@ sudo chown -R $USER: rootfs

find rootfs/usr/lib -name '*.h' -delete
find rootfs/usr/lib -name '*.pod' -delete

# Ruby
cd containers/ruby

docker build -t ruby-build .

id=`docker run -d ruby-build true`

mkdir -p rootfs/lib rootfs/usr/{bin,lib}

docker cp $id:/lib/ld-musl-x86_64.so.1 rootfs/lib
docker cp $id:/usr/bin/ruby rootfs/usr/bin
docker cp $id:/usr/lib/ruby rootfs/usr/lib
docker rm $id

sudo chown -R $USER: rootfs
1 change: 1 addition & 0 deletions code-golf.go
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,7 @@ func runCode(lang, code string) string {
Args: []string{"runc", "start", "id"},
Dir: "containers/" + lang,
Path: "/usr/bin/runc",
Stderr: os.Stdout,
Stdin: strings.NewReader(code),
Stdout: &out,
}
Expand Down
13 changes: 13 additions & 0 deletions containers/ruby/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
FROM alpine:edge

RUN apk add --no-cache curl gcc linux-headers make musl-dev

RUN curl https://cache.ruby-lang.org/pub/ruby/2.4/ruby-2.4.1.tar.xz \
| tar xJf -

RUN cd ruby-2.4.1 \
&& ./configure \
--disable-install-doc \
--prefix=/usr \
&& make \
&& make install
144 changes: 144 additions & 0 deletions containers/ruby/config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,144 @@
{
"process": {
"user": {},
"args": [
"/usr/bin/ruby"
],
"cwd": "/",
"capabilities": [
"CAP_AUDIT_WRITE",
"CAP_KILL",
"CAP_NET_BIND_SERVICE"
],
"rlimits": [
{
"type": "RLIMIT_NOFILE",
"hard": 1024,
"soft": 1024
}
],
"noNewPrivileges": true
},
"root": {
"path": "rootfs",
"readonly": true
},
"hostname": "ruby",
"mounts": [
{
"destination": "/proc",
"type": "proc",
"source": "proc"
},
{
"destination": "/dev",
"type": "tmpfs",
"source": "tmpfs",
"options": [
"nosuid",
"strictatime",
"mode=755",
"size=65536k"
]
},
{
"destination": "/dev/pts",
"type": "devpts",
"source": "devpts",
"options": [
"nosuid",
"noexec",
"newinstance",
"ptmxmode=0666",
"mode=0620",
"gid=5"
]
},
{
"destination": "/dev/shm",
"type": "tmpfs",
"source": "shm",
"options": [
"nosuid",
"noexec",
"nodev",
"mode=1777",
"size=65536k"
]
},
{
"destination": "/dev/mqueue",
"type": "mqueue",
"source": "mqueue",
"options": [
"nosuid",
"noexec",
"nodev"
]
},
{
"destination": "/sys",
"type": "sysfs",
"source": "sysfs",
"options": [
"nosuid",
"noexec",
"nodev",
"ro"
]
},
{
"destination": "/sys/fs/cgroup",
"type": "cgroup",
"source": "cgroup",
"options": [
"nosuid",
"noexec",
"nodev",
"relatime",
"ro"
]
}
],
"linux": {
"resources": {
"devices": [
{
"allow": false,
"access": "rwm"
}
]
},
"namespaces": [
{
"type": "pid"
},
{
"type": "network"
},
{
"type": "ipc"
},
{
"type": "uts"
},
{
"type": "mount"
}
],
"maskedPaths": [
"/proc/kcore",
"/proc/latency_stats",
"/proc/timer_stats",
"/proc/sched_debug"
],
"readonlyPaths": [
"/proc/asound",
"/proc/bus",
"/proc/fs",
"/proc/irq",
"/proc/sys",
"/proc/sysrq-trigger"
]
}
}
1 change: 1 addition & 0 deletions examples.go
Original file line number Diff line number Diff line change
Expand Up @@ -75,5 +75,6 @@ var examples = map[string]string{
print("Fizz\n")
else
print("#{number}\n")
end
end`,
}

0 comments on commit 8029a96

Please sign in to comment.