Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save tomdottom/0f27eb80c7666a6debd3014da292db44 to your computer and use it in GitHub Desktop.
Save tomdottom/0f27eb80c7666a6debd3014da292db44 to your computer and use it in GitHub Desktop.
Steps needed to compile a uwsgi binary with --json option support on alpine linux
# As root prepare build user
apk update
apk add sudo
adduser -D build
addgroup build abuild
addgroup abuild root
echo 'build ALL=(ALL) NOPASSWD: ALL' >> /etc/sudoers
# Switch to build user
su build
export PATH=$PATH:/sbin/
# Install build dependencies
sudo apk add alpine-sdk
# Clone main aport build defs
cd ~
git clone https://github.com/alpinelinux/aports.git
# Build uwsgi with json support
sudo apk add jansson-dev
cd aports/main/uwsgi
abuild checksum
abuild-keygen -ani
# abuild -r
abuild deps
abuild fetch
abuild unpack
abuild prepare
abuild build
abuild package
# Check that it was compiled with '--json' support
ldd ./pkg/uwsgi/usr/sbin/uwsgi | grep jansson
# copy somewhere for later
cp ./pkg/uwsgi/usr/sbin/uwsgi /dist/
# To install on fresh system copy binary
cp /dist/uwsgi /usr/sbin/uwsgi
# And install dependencies
apk update
# apk info --depends uwsgi | tail -n+2 | xargs -I{} apk add {}
# apk add jansson
apk add \
mailcap \
busybox \
so:libc.musl-x86_64.so.1 \
so:libcap.so.2 \
so:libcrypto.so.38 \
so:libpcre.so.1 \
so:libssl.so.39 \
so:libxml2.so.2 \
so:libz.so.1 \
jansson
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment