From 81709cb45519cd84670f79ed4395285e8c7a4949 Mon Sep 17 00:00:00 2001 From: Joe Groocock Date: Fri, 31 Aug 2018 16:31:25 +0100 Subject: [PATCH] Build su-exec and tini from source --- Dockerfile | 26 +++++++++++++++++++++----- tini-gnudef.patch | 12 ++++++++++++ 2 files changed, 33 insertions(+), 5 deletions(-) create mode 100644 tini-gnudef.patch diff --git a/Dockerfile b/Dockerfile index cbbc3aa..97d7d7e 100644 --- a/Dockerfile +++ b/Dockerfile @@ -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. diff --git a/tini-gnudef.patch b/tini-gnudef.patch new file mode 100644 index 0000000..c450da2 --- /dev/null +++ b/tini-gnudef.patch @@ -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 + #include