Skip to content

Commit 8029a96

Browse files
committed
Add ruby
1 parent 9cfd674 commit 8029a96

File tree

6 files changed

+177
-1
lines changed

6 files changed

+177
-1
lines changed

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
/app
2-
/containers/perl/rootfs/
2+
/containers/*/rootfs/
33
/static.go

build-langs

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
docker pull alpine:edge
44

5+
# Perl
56
cd containers/perl
67

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

2021
find rootfs/usr/lib -name '*.h' -delete
2122
find rootfs/usr/lib -name '*.pod' -delete
23+
24+
# Ruby
25+
cd containers/ruby
26+
27+
docker build -t ruby-build .
28+
29+
id=`docker run -d ruby-build true`
30+
31+
mkdir -p rootfs/lib rootfs/usr/{bin,lib}
32+
33+
docker cp $id:/lib/ld-musl-x86_64.so.1 rootfs/lib
34+
docker cp $id:/usr/bin/ruby rootfs/usr/bin
35+
docker cp $id:/usr/lib/ruby rootfs/usr/lib
36+
docker rm $id
37+
38+
sudo chown -R $USER: rootfs

code-golf.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -194,6 +194,7 @@ func runCode(lang, code string) string {
194194
Args: []string{"runc", "start", "id"},
195195
Dir: "containers/" + lang,
196196
Path: "/usr/bin/runc",
197+
Stderr: os.Stdout,
197198
Stdin: strings.NewReader(code),
198199
Stdout: &out,
199200
}

containers/ruby/Dockerfile

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
FROM alpine:edge
2+
3+
RUN apk add --no-cache curl gcc linux-headers make musl-dev
4+
5+
RUN curl https://cache.ruby-lang.org/pub/ruby/2.4/ruby-2.4.1.tar.xz \
6+
| tar xJf -
7+
8+
RUN cd ruby-2.4.1 \
9+
&& ./configure \
10+
--disable-install-doc \
11+
--prefix=/usr \
12+
&& make \
13+
&& make install

containers/ruby/config.json

Lines changed: 144 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,144 @@
1+
{
2+
"process": {
3+
"user": {},
4+
"args": [
5+
"/usr/bin/ruby"
6+
],
7+
"cwd": "/",
8+
"capabilities": [
9+
"CAP_AUDIT_WRITE",
10+
"CAP_KILL",
11+
"CAP_NET_BIND_SERVICE"
12+
],
13+
"rlimits": [
14+
{
15+
"type": "RLIMIT_NOFILE",
16+
"hard": 1024,
17+
"soft": 1024
18+
}
19+
],
20+
"noNewPrivileges": true
21+
},
22+
"root": {
23+
"path": "rootfs",
24+
"readonly": true
25+
},
26+
"hostname": "ruby",
27+
"mounts": [
28+
{
29+
"destination": "/proc",
30+
"type": "proc",
31+
"source": "proc"
32+
},
33+
{
34+
"destination": "/dev",
35+
"type": "tmpfs",
36+
"source": "tmpfs",
37+
"options": [
38+
"nosuid",
39+
"strictatime",
40+
"mode=755",
41+
"size=65536k"
42+
]
43+
},
44+
{
45+
"destination": "/dev/pts",
46+
"type": "devpts",
47+
"source": "devpts",
48+
"options": [
49+
"nosuid",
50+
"noexec",
51+
"newinstance",
52+
"ptmxmode=0666",
53+
"mode=0620",
54+
"gid=5"
55+
]
56+
},
57+
{
58+
"destination": "/dev/shm",
59+
"type": "tmpfs",
60+
"source": "shm",
61+
"options": [
62+
"nosuid",
63+
"noexec",
64+
"nodev",
65+
"mode=1777",
66+
"size=65536k"
67+
]
68+
},
69+
{
70+
"destination": "/dev/mqueue",
71+
"type": "mqueue",
72+
"source": "mqueue",
73+
"options": [
74+
"nosuid",
75+
"noexec",
76+
"nodev"
77+
]
78+
},
79+
{
80+
"destination": "/sys",
81+
"type": "sysfs",
82+
"source": "sysfs",
83+
"options": [
84+
"nosuid",
85+
"noexec",
86+
"nodev",
87+
"ro"
88+
]
89+
},
90+
{
91+
"destination": "/sys/fs/cgroup",
92+
"type": "cgroup",
93+
"source": "cgroup",
94+
"options": [
95+
"nosuid",
96+
"noexec",
97+
"nodev",
98+
"relatime",
99+
"ro"
100+
]
101+
}
102+
],
103+
"linux": {
104+
"resources": {
105+
"devices": [
106+
{
107+
"allow": false,
108+
"access": "rwm"
109+
}
110+
]
111+
},
112+
"namespaces": [
113+
{
114+
"type": "pid"
115+
},
116+
{
117+
"type": "network"
118+
},
119+
{
120+
"type": "ipc"
121+
},
122+
{
123+
"type": "uts"
124+
},
125+
{
126+
"type": "mount"
127+
}
128+
],
129+
"maskedPaths": [
130+
"/proc/kcore",
131+
"/proc/latency_stats",
132+
"/proc/timer_stats",
133+
"/proc/sched_debug"
134+
],
135+
"readonlyPaths": [
136+
"/proc/asound",
137+
"/proc/bus",
138+
"/proc/fs",
139+
"/proc/irq",
140+
"/proc/sys",
141+
"/proc/sysrq-trigger"
142+
]
143+
}
144+
}

examples.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,5 +75,6 @@ var examples = map[string]string{
7575
print("Fizz\n")
7676
else
7777
print("#{number}\n")
78+
end
7879
end`,
7980
}

0 commit comments

Comments
 (0)