about summary refs log tree commit diff
diff options
context:
space:
mode:
-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