1*1784Sthresh@nginx.comFROM debian:buster-slim as BUILDER 2509Sthresh@nginx.com 3509Sthresh@nginx.comLABEL maintainer="NGINX Docker Maintainers <docker-maint@nginx.com>" 4509Sthresh@nginx.com 5*1784Sthresh@nginx.comRUN set -ex \ 6*1784Sthresh@nginx.com && apt-get update \ 7*1784Sthresh@nginx.com && apt-get install --no-install-recommends --no-install-suggests -y ca-certificates mercurial build-essential libssl-dev libpcre2-dev \ 8*1784Sthresh@nginx.com && mkdir -p /usr/lib/unit/modules /usr/lib/unit/debug-modules \ 9*1784Sthresh@nginx.com && hg clone https://hg.nginx.org/unit \ 10*1784Sthresh@nginx.com && cd unit \ 11*1784Sthresh@nginx.com && hg up 1.21.0 \ 12*1784Sthresh@nginx.com && NCPU="$(getconf _NPROCESSORS_ONLN)" \ 13*1784Sthresh@nginx.com && DEB_HOST_MULTIARCH="$(dpkg-architecture -q DEB_HOST_MULTIARCH)" \ 14*1784Sthresh@nginx.com && CC_OPT="$(DEB_BUILD_MAINT_OPTIONS="hardening=+all,-pie" DEB_CFLAGS_MAINT_APPEND="-Wp,-D_FORTIFY_SOURCE=2 -fPIC" dpkg-buildflags --get CFLAGS)" \ 15*1784Sthresh@nginx.com && LD_OPT="$(DEB_BUILD_MAINT_OPTIONS="hardening=+all,-pie" DEB_LDFLAGS_MAINT_APPEND="-Wl,--as-needed -pie" dpkg-buildflags --get LDFLAGS)" \ 16*1784Sthresh@nginx.com && CONFIGURE_ARGS="--prefix=/usr \ 17*1784Sthresh@nginx.com --state=/var/lib/unit \ 18*1784Sthresh@nginx.com --control=unix:/var/run/control.unit.sock \ 19*1784Sthresh@nginx.com --pid=/var/run/unit.pid \ 20*1784Sthresh@nginx.com --log=/var/log/unit.log \ 21*1784Sthresh@nginx.com --tmp=/var/tmp \ 22*1784Sthresh@nginx.com --user=unit \ 23*1784Sthresh@nginx.com --group=unit \ 24*1784Sthresh@nginx.com --openssl \ 25*1784Sthresh@nginx.com --libdir=/usr/lib/$DEB_HOST_MULTIARCH" \ 26*1784Sthresh@nginx.com && ./configure $CONFIGURE_ARGS --cc-opt="$CC_OPT" --ld-opt="$LD_OPT" --modules=/usr/lib/unit/debug-modules --debug \ 27*1784Sthresh@nginx.com && make -j $NCPU unitd \ 28*1784Sthresh@nginx.com && install -pm755 build/unitd /usr/sbin/unitd-debug \ 29*1784Sthresh@nginx.com && make clean \ 30*1784Sthresh@nginx.com && ./configure $CONFIGURE_ARGS --cc-opt="$CC_OPT" --ld-opt="$LD_OPT" --modules=/usr/lib/unit/modules \ 31*1784Sthresh@nginx.com && make -j $NCPU unitd \ 32*1784Sthresh@nginx.com && install -pm755 build/unitd /usr/sbin/unitd \ 33*1784Sthresh@nginx.com && make clean \ 34*1784Sthresh@nginx.com && ./configure $CONFIGURE_ARGS --cc-opt="$CC_OPT" --modules=/usr/lib/unit/debug-modules --debug \ 35*1784Sthresh@nginx.com && ./configure \ 36*1784Sthresh@nginx.com && make -j $NCPU version \ 37*1784Sthresh@nginx.com && make clean \ 38*1784Sthresh@nginx.com && ./configure $CONFIGURE_ARGS --cc-opt="$CC_OPT" --modules=/usr/lib/unit/modules \ 39*1784Sthresh@nginx.com && ./configure \ 40*1784Sthresh@nginx.com && make -j $NCPU version \ 41*1784Sthresh@nginx.com && ldd /usr/sbin/unitd | awk '/=>/{print $(NF-1)}' | while read n; do dpkg-query -S $n; done | sed 's/^\([^:]\+\):.*$/\1/' | sort | uniq > /requirements.apt 42*1784Sthresh@nginx.com 43*1784Sthresh@nginx.comFROM debian:buster-slim 44*1784Sthresh@nginx.comCOPY docker-entrypoint.sh /usr/local/bin/ 45*1784Sthresh@nginx.comCOPY --from=BUILDER /usr/sbin/unitd /usr/sbin/unitd 46*1784Sthresh@nginx.comCOPY --from=BUILDER /usr/sbin/unitd-debug /usr/sbin/unitd-debug 47*1784Sthresh@nginx.comCOPY --from=BUILDER /usr/lib/unit/ /usr/lib/unit/ 48*1784Sthresh@nginx.comCOPY --from=BUILDER /requirements.apt /requirements.apt 49509Sthresh@nginx.com 50509Sthresh@nginx.comRUN set -x \ 51*1784Sthresh@nginx.com && mkdir -p /var/lib/unit/ \ 52*1784Sthresh@nginx.com && mkdir /docker-entrypoint.d/ \ 53*1784Sthresh@nginx.com && addgroup --system unit \ 54*1784Sthresh@nginx.com && adduser \ 55*1784Sthresh@nginx.com --system \ 56*1784Sthresh@nginx.com --disabled-login \ 57*1784Sthresh@nginx.com --ingroup unit \ 58*1784Sthresh@nginx.com --no-create-home \ 59*1784Sthresh@nginx.com --home /nonexistent \ 60*1784Sthresh@nginx.com --gecos "unit user" \ 61*1784Sthresh@nginx.com --shell /bin/false \ 62*1784Sthresh@nginx.com unit \ 63*1784Sthresh@nginx.com && apt update \ 64*1784Sthresh@nginx.com && apt --no-install-recommends --no-install-suggests -y install $(cat /requirements.apt) \ 65*1784Sthresh@nginx.com && apt-get clean && rm -rf /var/lib/apt/lists/* \ 66*1784Sthresh@nginx.com && rm -f /requirements.apt \ 67*1784Sthresh@nginx.com && ln -sf /dev/stdout /var/log/unit.log 68509Sthresh@nginx.com 69509Sthresh@nginx.comSTOPSIGNAL SIGTERM 70509Sthresh@nginx.com 711220Sthresh@nginx.comENTRYPOINT ["/usr/local/bin/docker-entrypoint.sh"] 721220Sthresh@nginx.com 73509Sthresh@nginx.comCMD ["unitd", "--no-daemon", "--control", "unix:/var/run/control.unit.sock"] 74