about summary refs log tree commit diff
diff options
context:
space:
mode:
authorLeah Neukirchen <leah@vuxu.org>2024-01-01 18:59:49 +0100
committerLeah Neukirchen <leah@vuxu.org>2024-01-01 18:59:49 +0100
commitce8c010d2f87e7b74065619ce698058b37d24106 (patch)
treed78b0597d6882b1dc4a3e46e5c6a0b58a821a10e
parenta9f32c27413b397b136d9630503ac42ac4dae6d3 (diff)
downloadnitro-ce8c010d2f87e7b74065619ce698058b37d24106.tar.gz
nitro-ce8c010d2f87e7b74065619ce698058b37d24106.tar.xz
nitro-ce8c010d2f87e7b74065619ce698058b37d24106.zip
add docker setup for static builds using alpine
-rw-r--r--Dockerfile.alpine16
-rwxr-xr-xbuild-alpine.sh4
2 files changed, 20 insertions, 0 deletions
diff --git a/Dockerfile.alpine b/Dockerfile.alpine
new file mode 100644
index 0000000..a16b827
--- /dev/null
+++ b/Dockerfile.alpine
@@ -0,0 +1,16 @@
+FROM alpine:latest
+
+RUN apk update \
+    && apk --no-cache --update add build-base
+
+WORKDIR /bin.alpine
+
+COPY nitro.c .
+COPY nitroctl.c .
+COPY Makefile .
+
+RUN make CFLAGS="-Os -Wl,--gc-sections -fno-asynchronous-unwind-tables -fno-stack-protector -fno-stack-clash-protection" LDFLAGS="-static"
+
+RUN nm --size-sort nitro
+RUN ls -l nitro nitroctl
+RUN size nitro nitroctl
diff --git a/build-alpine.sh b/build-alpine.sh
new file mode 100755
index 0000000..fe5e4cb
--- /dev/null
+++ b/build-alpine.sh
@@ -0,0 +1,4 @@
+#!/bin/sh -e
+rm -rf bin.alpine
+docker build -f Dockerfile.alpine --progress=plain --iidfile=id.alpine .
+docker save $(cat id.alpine) | bsdtar xO '*/layer.tar' | bsdtar xv --ignore-zeros bin.alpine/nitro bin.alpine/nitroctl