Skip to content

Instantly share code, notes, and snippets.

@isavcic
Created February 21, 2020 11:05
Show Gist options
  • Save isavcic/c44bf586bff18c4c52543110ddf657ff to your computer and use it in GitHub Desktop.
Save isavcic/c44bf586bff18c4c52543110ddf657ff to your computer and use it in GitHub Desktop.
nsjail static build
#!/bin/bash
### Usage:
# docker run --rm -v $(pwd)/nsjail-static-build.sh:/nsjail-static-build.sh -v $(pwd):/out ubuntu:18.04 ./nsjail-static-build.sh
apt-get -y update && apt-get install -y \
autoconf \
bison \
flex \
gcc \
g++ \
git \
libprotobuf-dev \
libnl-route-3-dev \
libtool \
make \
pkg-config \
protobuf-compiler \
upx
git clone https://github.com/google/nsjail.git
cd /nsjail
sed -i 's/^LDFLAGS\(.*\)/LDFLAGS\1 -static/' Makefile
make && mv /nsjail/nsjail /out && strip /out/nsjail && upx /out/nsjail
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment