Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit de60783

Browse files
Experimental nsjail build
1 parent 8020888 commit de60783

File tree

5 files changed

+931
-0
lines changed

5 files changed

+931
-0
lines changed

‎Dockerfile.libnl-3.2.25

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
ARG MUSL_TARGET=x86_64-linux-musl
2+
FROM musl-cross-make-$MUSL_TARGET
3+
ARG MUSL_TARGET
4+
5+
WORKDIR /build
6+
RUN download https://www.infradead.org/~tgr/libnl/files/libnl-3.2.25.tar.gz source.tar.gz 8beb7590674957b931de6b7f81c530b85dc7c1ad8fbda015398bc1e8d1ce8ec5 && tar xf source.tar.gz
7+
RUN export PATH=/build/cross/bin:$PATH && \
8+
cd libnl-* && \
9+
CC="$MUSL_TARGET-gcc" \
10+
CFLAGS="-static -frandom-seed=pulse" \
11+
./configure \
12+
--disable-shared \
13+
--enable-static \
14+
--host=$($MUSL_TARGET-gcc -dumpmachine) \
15+
--prefix=/output && \
16+
make -j$(nproc) && \
17+
make install
18+
19+
CMD bash

‎Dockerfile.nsjail-3.0

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
ARG MUSL_TARGET=x86_64-linux-musl
2+
FROM libnl-3.2.25-${MUSL_TARGET} AS libnl
3+
FROM protobuf-3.19.1-${MUSL_TARGET} AS protobuf
4+
FROM musl-cross-make-${MUSL_TARGET}
5+
ARG MUSL_TARGET
6+
7+
COPY --from=protobuf /output /output
8+
COPY --from=libnl /output /output
9+
10+
WORKDIR /build
11+
RUN download https://github.com/google/nsjail/archive/refs/tags/3.0.tar.gz source.tar.gz cfa66d3ed136b2e221752287b95e544915e8a6760aa866f023b604d14a374919 && tar xf source.tar.gz
12+
RUN download https://github.com/google/kafel/archive/refs/tags/20200831.tar.gz kafel.tar.gz dc6a541e4699acb2ac76128142780604452694d747dfd31a809a90506f965d7e && tar xf kafel.tar.gz
13+
RUN download https://github.com/protocolbuffers/protobuf/releases/download/v3.19.1/protoc-3.19.1-linux-x86_64.zip protoc.zip 4b18a69b3093432ee0531bc9bf3c4114f81bde1670ade2875f694180ac8bd7f6 && unzip protoc.zip
14+
COPY patches/nsjail-3.0 /build/patches
15+
RUN export PATH=/build/cross/bin:$PATH:/output/bin && \
16+
mkdir -p /output/bin && \
17+
mkdir -p /output/include/sys && \
18+
echo "#!/bin/sh\nexit 0" > /output/bin/pkg-config && \
19+
chmod 0755 /output/bin/pkg-config && \
20+
cp /build/patches/queue.h /output/include/sys && \
21+
cp bin/protoc /output/bin && \
22+
cp -r kafel-*/* nsjail-*/kafel && \
23+
cd nsjail-* && \
24+
find /output && \
25+
sed -e 's/-Werror//' -e 's/-pie//' -e 's/-fPIE//' -i Makefile && \
26+
sed -e 's/YYUSE/YY_USE/' -i kafel/src/parser.y && \
27+
sed -e 's/^TARGET=.*/TARGET=${STATIC_TARGET}/' -i kafel/src/Makefile && \
28+
export CC="$MUSL_TARGET-gcc -static" && \
29+
export CXX="$MUSL_TARGET-g++ -static" && \
30+
export CFLAGS="-I/output/include -I/output/include/libnl3 -I/output/include/google -static -frandom-seed=pulse" && \
31+
export COMMON_FLAGS="-static -I/output/include -I/output/include/libnl3 -I/output/include/google" && \
32+
export LDFLAGS="-L/output/lib -pthread -lprotobuf -lnl-route-3 -lnl-3" && \
33+
make -j$(nproc) && \
34+
${MUSL_TARGET}-strip nsjail
35+
36+
CMD bash

‎Dockerfile.protobuf-3.19.1

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
ARG MUSL_TARGET=x86_64-linux-musl
2+
FROM musl-cross-make-$MUSL_TARGET
3+
ARG MUSL_TARGET
4+
5+
WORKDIR /build
6+
RUN download https://github.com/protocolbuffers/protobuf/releases/download/v3.19.1/protobuf-cpp-3.19.1.tar.gz source.tar.gz 645192532f28254152b51c01868efdf9b766b1dbe49c77cccd6efcdb2d7c7bc2 && tar xf source.tar.gz
7+
RUN export PATH=/build/cross/bin:$PATH && \
8+
cd protobuf-* && \
9+
export CC="$MUSL_TARGET-gcc" && \
10+
export CXX="$MUSL_TARGET-g++" && \
11+
export CFLAGS="-static -frandom-seed=pulse" && \
12+
./configure \
13+
--disable-shared \
14+
--enable-static \
15+
--host=$($MUSL_TARGET-gcc -dumpmachine) \
16+
--prefix=/output && \
17+
make -j$(nproc) && \
18+
make install
19+
20+
CMD bash

‎Makefile

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,12 @@ zlib-1.2.11: musl-cross-make
2727
pcre-8.45: musl-cross-make
2828
$(DOCKER_BUILD)
2929

30+
libnl-3.2.25: musl-cross-make
31+
$(DOCKER_BUILD)
32+
33+
protobuf-3.19.1: musl-cross-make
34+
$(DOCKER_BUILD)
35+
3036
expat-2.4.1: musl-cross-make
3137
$(DOCKER_BUILD)
3238

@@ -88,6 +94,10 @@ busybox-1.33.1: musl-cross-make
8894
$(DOCKER_BUILD)
8995
$(GRABBY_HANDS) /output/bin/busybox /grabby/$@
9096

97+
nsjail-3.0: libnl-3.2.25 protobuf-3.19.1
98+
$(DOCKER_BUILD)
99+
$(GRABBY_HANDS) /build/nsjail-3.0/nsjail /grabby/$@
100+
91101
# By default just build the basic 'git' binary. If you want "everything" then set GIT_FULL as an environment variable. The 'git-versionnumber' binary will need to be renamed to just 'git' to work.
92102
git-2.33.0: expat-2.4.1 openssl-1.1.1k curl-7.79.1 zlib-1.2.11
93103
$(DOCKER_BUILD)

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /