Build su-exec and tini from source

This commit is contained in:
Joe Groocock 2018-08-31 16:31:25 +01:00
parent 8d84007b1e
commit 81709cb455
Signed by: frebib
GPG Key ID: E0B16BEACFBB6A86
2 changed files with 33 additions and 5 deletions

View File

@ -26,11 +26,6 @@ RUN mkdir -p dev etc home proc root tmp usr/{bin,lib/pkgconfig,lib32} var && \
ln -sv usr/bin sbin && \
ln -sv bin usr/sbin
# Pull tini and su-exec utilities
RUN curl -fL https://github.com/frebib/su-exec/releases/download/v${SU_EXEC_VER}/su-exec-x86_64 > sbin/su-exec && \
curl -fL https://github.com/krallin/tini/releases/download/v${TINI_VER}/tini-amd64 > sbin/tini && \
chmod +x sbin/su-exec sbin/tini
WORKDIR /tmp/glibc/build
# Download and build glibc from source
@ -84,6 +79,27 @@ RUN curl -fL https://busybox.net/downloads/busybox-${BUSYB_VER}.tar.bz2 \
# "Install" busybox, creating symlinks to all binaries it provides
./busybox --list-full | xargs -i ln -s /bin/busybox "${PREFIX}/{}"
WORKDIR /tmp/su-exec
# Download and build su-exec from source
RUN apt-get -y install xxd
RUN curl -fL https://github.com/frebib/su-exec/archive/v${SU_EXEC_VER}.tar.gz \
| tar xz --strip-components=1 && \
make && \
strip -s su-exec && \
mv su-exec "${PREFIX}/sbin"
WORKDIR /tmp/tini
# Download and build tini from source
ADD tini-gnudef.patch /tmp
RUN curl -fL https://github.com/krallin/tini/archive/v${TINI_VER}.tar.gz \
| tar xz --strip-components=1 && \
patch -p1 < /tmp/tini-gnudef.patch && \
cmake . && \
make tini && \
mv tini "${PREFIX}/sbin"
WORKDIR $PREFIX
# Generate initial ld.so.cache so ELF binaries work.

12
tini-gnudef.patch Normal file
View File

@ -0,0 +1,12 @@
diff --git a/src/tini.c b/src/tini.c
index 3ad8232..77f7caa 100644
--- a/src/tini.c
+++ b/src/tini.c
@@ -1,5 +1,7 @@
/* See LICENSE file for copyright and license details. */
+#ifndef _GNU_SOURCE
#define _GNU_SOURCE
+#endif
#include <sys/types.h>
#include <sys/wait.h>