xref: /unit/pkg/docker/Dockerfile.perl5.36 (revision 2198:ea073fb3cb75)
12193Sthresh@nginx.comFROM perl:5.36 as BUILDER
22193Sthresh@nginx.com
32193Sthresh@nginx.comLABEL maintainer="NGINX Docker Maintainers <docker-maint@nginx.com>"
42193Sthresh@nginx.com
52193Sthresh@nginx.comRUN set -ex \
62193Sthresh@nginx.com    && apt-get update \
72193Sthresh@nginx.com    && apt-get install --no-install-recommends --no-install-suggests -y ca-certificates mercurial build-essential libssl-dev libpcre2-dev \
82193Sthresh@nginx.com    && mkdir -p /usr/lib/unit/modules /usr/lib/unit/debug-modules \
92193Sthresh@nginx.com    && hg clone https://hg.nginx.org/unit \
102193Sthresh@nginx.com    && cd unit \
11*2198Szelenkov@nginx.com    && hg up 1.28.0 \
122193Sthresh@nginx.com    && NCPU="$(getconf _NPROCESSORS_ONLN)" \
132193Sthresh@nginx.com    && DEB_HOST_MULTIARCH="$(dpkg-architecture -q DEB_HOST_MULTIARCH)" \
142193Sthresh@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)" \
152193Sthresh@nginx.com    && LD_OPT="$(DEB_BUILD_MAINT_OPTIONS="hardening=+all,-pie" DEB_LDFLAGS_MAINT_APPEND="-Wl,--as-needed -pie" dpkg-buildflags --get LDFLAGS)" \
162193Sthresh@nginx.com    && CONFIGURE_ARGS="--prefix=/usr \
172193Sthresh@nginx.com                --state=/var/lib/unit \
182193Sthresh@nginx.com                --control=unix:/var/run/control.unit.sock \
192193Sthresh@nginx.com                --pid=/var/run/unit.pid \
202193Sthresh@nginx.com                --log=/var/log/unit.log \
212193Sthresh@nginx.com                --tmp=/var/tmp \
222193Sthresh@nginx.com                --user=unit \
232193Sthresh@nginx.com                --group=unit \
242193Sthresh@nginx.com                --openssl \
252193Sthresh@nginx.com                --libdir=/usr/lib/$DEB_HOST_MULTIARCH" \
262193Sthresh@nginx.com    && ./configure $CONFIGURE_ARGS --cc-opt="$CC_OPT" --ld-opt="$LD_OPT" --modules=/usr/lib/unit/debug-modules --debug \
272193Sthresh@nginx.com    && make -j $NCPU unitd \
282193Sthresh@nginx.com    && install -pm755 build/unitd /usr/sbin/unitd-debug \
292193Sthresh@nginx.com    && make clean \
302193Sthresh@nginx.com    && ./configure $CONFIGURE_ARGS --cc-opt="$CC_OPT" --ld-opt="$LD_OPT" --modules=/usr/lib/unit/modules \
312193Sthresh@nginx.com    && make -j $NCPU unitd \
322193Sthresh@nginx.com    && install -pm755 build/unitd /usr/sbin/unitd \
332193Sthresh@nginx.com    && make clean \
342193Sthresh@nginx.com    && ./configure $CONFIGURE_ARGS --cc-opt="$CC_OPT" --modules=/usr/lib/unit/debug-modules --debug \
352193Sthresh@nginx.com    && ./configure perl \
362193Sthresh@nginx.com    && make -j $NCPU perl-install \
372193Sthresh@nginx.com    && make clean \
382193Sthresh@nginx.com    && ./configure $CONFIGURE_ARGS --cc-opt="$CC_OPT" --modules=/usr/lib/unit/modules \
392193Sthresh@nginx.com    && ./configure perl \
402193Sthresh@nginx.com    && make -j $NCPU perl-install \
412193Sthresh@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
422193Sthresh@nginx.com
432193Sthresh@nginx.comFROM perl:5.36
442193Sthresh@nginx.comCOPY docker-entrypoint.sh /usr/local/bin/
452193Sthresh@nginx.comCOPY --from=BUILDER /usr/sbin/unitd /usr/sbin/unitd
462193Sthresh@nginx.comCOPY --from=BUILDER /usr/sbin/unitd-debug /usr/sbin/unitd-debug
472193Sthresh@nginx.comCOPY --from=BUILDER /usr/lib/unit/ /usr/lib/unit/
482193Sthresh@nginx.comCOPY --from=BUILDER /requirements.apt /requirements.apt
492193Sthresh@nginx.com
502193Sthresh@nginx.comRUN set -x \
512193Sthresh@nginx.com    && if [ -f "/tmp/libunit.a" ]; then \
522193Sthresh@nginx.com        mv /tmp/libunit.a /usr/lib/$(dpkg-architecture -q DEB_HOST_MULTIARCH)/libunit.a; \
532193Sthresh@nginx.com        rm -f /tmp/libunit.a; \
542193Sthresh@nginx.com    fi \
552193Sthresh@nginx.com    && mkdir -p /var/lib/unit/ \
562193Sthresh@nginx.com    && mkdir /docker-entrypoint.d/ \
572193Sthresh@nginx.com    && addgroup --system unit \
582193Sthresh@nginx.com    && adduser \
592193Sthresh@nginx.com         --system \
602193Sthresh@nginx.com         --disabled-login \
612193Sthresh@nginx.com         --ingroup unit \
622193Sthresh@nginx.com         --no-create-home \
632193Sthresh@nginx.com         --home /nonexistent \
642193Sthresh@nginx.com         --gecos "unit user" \
652193Sthresh@nginx.com         --shell /bin/false \
662193Sthresh@nginx.com         unit \
672193Sthresh@nginx.com    && apt update \
682193Sthresh@nginx.com    && apt --no-install-recommends --no-install-suggests -y install curl $(cat /requirements.apt) \
692193Sthresh@nginx.com    && apt-get clean && rm -rf /var/lib/apt/lists/* \
702193Sthresh@nginx.com    && rm -f /requirements.apt \
712193Sthresh@nginx.com    && ln -sf /dev/stdout /var/log/unit.log
722193Sthresh@nginx.com
732193Sthresh@nginx.comSTOPSIGNAL SIGTERM
742193Sthresh@nginx.com
752193Sthresh@nginx.comENTRYPOINT ["/usr/local/bin/docker-entrypoint.sh"]
762193Sthresh@nginx.com
772193Sthresh@nginx.comCMD ["unitd", "--no-daemon", "--control", "unix:/var/run/control.unit.sock"]
78