11958Sthresh@nginx.comFROM perl:5.34 as BUILDER 21958Sthresh@nginx.com 31958Sthresh@nginx.comLABEL maintainer="NGINX Docker Maintainers <docker-maint@nginx.com>" 41958Sthresh@nginx.com 51958Sthresh@nginx.comRUN set -ex \ 61958Sthresh@nginx.com && apt-get update \ 71958Sthresh@nginx.com && apt-get install --no-install-recommends --no-install-suggests -y ca-certificates mercurial build-essential libssl-dev libpcre2-dev \ 81958Sthresh@nginx.com && mkdir -p /usr/lib/unit/modules /usr/lib/unit/debug-modules \ 91958Sthresh@nginx.com && hg clone https://hg.nginx.org/unit \ 101958Sthresh@nginx.com && cd unit \ 112046Svbart@nginx.com && hg up 1.26.1 \ 121958Sthresh@nginx.com && NCPU="$(getconf _NPROCESSORS_ONLN)" \ 131958Sthresh@nginx.com && DEB_HOST_MULTIARCH="$(dpkg-architecture -q DEB_HOST_MULTIARCH)" \ 141958Sthresh@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)" \ 151958Sthresh@nginx.com && LD_OPT="$(DEB_BUILD_MAINT_OPTIONS="hardening=+all,-pie" DEB_LDFLAGS_MAINT_APPEND="-Wl,--as-needed -pie" dpkg-buildflags --get LDFLAGS)" \ 161958Sthresh@nginx.com && CONFIGURE_ARGS="--prefix=/usr \ 171958Sthresh@nginx.com --state=/var/lib/unit \ 181958Sthresh@nginx.com --control=unix:/var/run/control.unit.sock \ 191958Sthresh@nginx.com --pid=/var/run/unit.pid \ 201958Sthresh@nginx.com --log=/var/log/unit.log \ 211958Sthresh@nginx.com --tmp=/var/tmp \ 221958Sthresh@nginx.com --user=unit \ 231958Sthresh@nginx.com --group=unit \ 241958Sthresh@nginx.com --openssl \ 251958Sthresh@nginx.com --libdir=/usr/lib/$DEB_HOST_MULTIARCH" \ 261958Sthresh@nginx.com && ./configure $CONFIGURE_ARGS --cc-opt="$CC_OPT" --ld-opt="$LD_OPT" --modules=/usr/lib/unit/debug-modules --debug \ 271958Sthresh@nginx.com && make -j $NCPU unitd \ 281958Sthresh@nginx.com && install -pm755 build/unitd /usr/sbin/unitd-debug \ 291958Sthresh@nginx.com && make clean \ 301958Sthresh@nginx.com && ./configure $CONFIGURE_ARGS --cc-opt="$CC_OPT" --ld-opt="$LD_OPT" --modules=/usr/lib/unit/modules \ 311958Sthresh@nginx.com && make -j $NCPU unitd \ 321958Sthresh@nginx.com && install -pm755 build/unitd /usr/sbin/unitd \ 331958Sthresh@nginx.com && make clean \ 341958Sthresh@nginx.com && ./configure $CONFIGURE_ARGS --cc-opt="$CC_OPT" --modules=/usr/lib/unit/debug-modules --debug \ 351958Sthresh@nginx.com && ./configure perl \ 361958Sthresh@nginx.com && make -j $NCPU perl-install \ 371958Sthresh@nginx.com && make clean \ 381958Sthresh@nginx.com && ./configure $CONFIGURE_ARGS --cc-opt="$CC_OPT" --modules=/usr/lib/unit/modules \ 391958Sthresh@nginx.com && ./configure perl \ 401958Sthresh@nginx.com && make -j $NCPU perl-install \ 411958Sthresh@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 421958Sthresh@nginx.com 431958Sthresh@nginx.comFROM perl:5.34 441958Sthresh@nginx.comCOPY docker-entrypoint.sh /usr/local/bin/ 451958Sthresh@nginx.comCOPY --from=BUILDER /usr/sbin/unitd /usr/sbin/unitd 461958Sthresh@nginx.comCOPY --from=BUILDER /usr/sbin/unitd-debug /usr/sbin/unitd-debug 471958Sthresh@nginx.comCOPY --from=BUILDER /usr/lib/unit/ /usr/lib/unit/ 481958Sthresh@nginx.comCOPY --from=BUILDER /requirements.apt /requirements.apt 491958Sthresh@nginx.com 501958Sthresh@nginx.comRUN set -x \ 51*2092Sthresh@nginx.com && if [ -f "/tmp/libunit.a" ]; then \ 52*2092Sthresh@nginx.com mv /tmp/libunit.a /usr/lib/$(dpkg-architecture -q DEB_HOST_MULTIARCH)/libunit.a; \ 53*2092Sthresh@nginx.com rm -f /tmp/libunit.a; \ 54*2092Sthresh@nginx.com fi \ 551958Sthresh@nginx.com && mkdir -p /var/lib/unit/ \ 561958Sthresh@nginx.com && mkdir /docker-entrypoint.d/ \ 571958Sthresh@nginx.com && addgroup --system unit \ 581958Sthresh@nginx.com && adduser \ 591958Sthresh@nginx.com --system \ 601958Sthresh@nginx.com --disabled-login \ 611958Sthresh@nginx.com --ingroup unit \ 621958Sthresh@nginx.com --no-create-home \ 631958Sthresh@nginx.com --home /nonexistent \ 641958Sthresh@nginx.com --gecos "unit user" \ 651958Sthresh@nginx.com --shell /bin/false \ 661958Sthresh@nginx.com unit \ 671958Sthresh@nginx.com && apt update \ 681958Sthresh@nginx.com && apt --no-install-recommends --no-install-suggests -y install curl $(cat /requirements.apt) \ 691958Sthresh@nginx.com && apt-get clean && rm -rf /var/lib/apt/lists/* \ 701958Sthresh@nginx.com && rm -f /requirements.apt \ 711958Sthresh@nginx.com && ln -sf /dev/stdout /var/log/unit.log 721958Sthresh@nginx.com 731958Sthresh@nginx.comSTOPSIGNAL SIGTERM 741958Sthresh@nginx.com 751958Sthresh@nginx.comENTRYPOINT ["/usr/local/bin/docker-entrypoint.sh"] 761958Sthresh@nginx.com 771958Sthresh@nginx.comCMD ["unitd", "--no-daemon", "--control", "unix:/var/run/control.unit.sock"] 78