xref: /unit/pkg/docker/Dockerfile.perl5.34 (revision 1958)
1*1958Sthresh@nginx.comFROM perl:5.34 as BUILDER
2*1958Sthresh@nginx.com
3*1958Sthresh@nginx.comLABEL maintainer="NGINX Docker Maintainers <docker-maint@nginx.com>"
4*1958Sthresh@nginx.com
5*1958Sthresh@nginx.comRUN set -ex \
6*1958Sthresh@nginx.com    && apt-get update \
7*1958Sthresh@nginx.com    && apt-get install --no-install-recommends --no-install-suggests -y ca-certificates mercurial build-essential libssl-dev libpcre2-dev \
8*1958Sthresh@nginx.com    && mkdir -p /usr/lib/unit/modules /usr/lib/unit/debug-modules \
9*1958Sthresh@nginx.com    && hg clone https://hg.nginx.org/unit \
10*1958Sthresh@nginx.com    && cd unit \
11*1958Sthresh@nginx.com    && hg up 1.25.0 \
12*1958Sthresh@nginx.com    && NCPU="$(getconf _NPROCESSORS_ONLN)" \
13*1958Sthresh@nginx.com    && DEB_HOST_MULTIARCH="$(dpkg-architecture -q DEB_HOST_MULTIARCH)" \
14*1958Sthresh@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*1958Sthresh@nginx.com    && LD_OPT="$(DEB_BUILD_MAINT_OPTIONS="hardening=+all,-pie" DEB_LDFLAGS_MAINT_APPEND="-Wl,--as-needed -pie" dpkg-buildflags --get LDFLAGS)" \
16*1958Sthresh@nginx.com    && CONFIGURE_ARGS="--prefix=/usr \
17*1958Sthresh@nginx.com                --state=/var/lib/unit \
18*1958Sthresh@nginx.com                --control=unix:/var/run/control.unit.sock \
19*1958Sthresh@nginx.com                --pid=/var/run/unit.pid \
20*1958Sthresh@nginx.com                --log=/var/log/unit.log \
21*1958Sthresh@nginx.com                --tmp=/var/tmp \
22*1958Sthresh@nginx.com                --user=unit \
23*1958Sthresh@nginx.com                --group=unit \
24*1958Sthresh@nginx.com                --openssl \
25*1958Sthresh@nginx.com                --libdir=/usr/lib/$DEB_HOST_MULTIARCH" \
26*1958Sthresh@nginx.com    && ./configure $CONFIGURE_ARGS --cc-opt="$CC_OPT" --ld-opt="$LD_OPT" --modules=/usr/lib/unit/debug-modules --debug \
27*1958Sthresh@nginx.com    && make -j $NCPU unitd \
28*1958Sthresh@nginx.com    && install -pm755 build/unitd /usr/sbin/unitd-debug \
29*1958Sthresh@nginx.com    && make clean \
30*1958Sthresh@nginx.com    && ./configure $CONFIGURE_ARGS --cc-opt="$CC_OPT" --ld-opt="$LD_OPT" --modules=/usr/lib/unit/modules \
31*1958Sthresh@nginx.com    && make -j $NCPU unitd \
32*1958Sthresh@nginx.com    && install -pm755 build/unitd /usr/sbin/unitd \
33*1958Sthresh@nginx.com    && make clean \
34*1958Sthresh@nginx.com    && ./configure $CONFIGURE_ARGS --cc-opt="$CC_OPT" --modules=/usr/lib/unit/debug-modules --debug \
35*1958Sthresh@nginx.com    && ./configure perl \
36*1958Sthresh@nginx.com    && make -j $NCPU perl-install \
37*1958Sthresh@nginx.com    && make clean \
38*1958Sthresh@nginx.com    && ./configure $CONFIGURE_ARGS --cc-opt="$CC_OPT" --modules=/usr/lib/unit/modules \
39*1958Sthresh@nginx.com    && ./configure perl \
40*1958Sthresh@nginx.com    && make -j $NCPU perl-install \
41*1958Sthresh@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*1958Sthresh@nginx.com
43*1958Sthresh@nginx.comFROM perl:5.34
44*1958Sthresh@nginx.comCOPY docker-entrypoint.sh /usr/local/bin/
45*1958Sthresh@nginx.comCOPY --from=BUILDER /usr/sbin/unitd /usr/sbin/unitd
46*1958Sthresh@nginx.comCOPY --from=BUILDER /usr/sbin/unitd-debug /usr/sbin/unitd-debug
47*1958Sthresh@nginx.comCOPY --from=BUILDER /usr/lib/unit/ /usr/lib/unit/
48*1958Sthresh@nginx.comCOPY --from=BUILDER /requirements.apt /requirements.apt
49*1958Sthresh@nginx.com
50*1958Sthresh@nginx.comRUN set -x \
51*1958Sthresh@nginx.com    && mkdir -p /var/lib/unit/ \
52*1958Sthresh@nginx.com    && mkdir /docker-entrypoint.d/ \
53*1958Sthresh@nginx.com    && addgroup --system unit \
54*1958Sthresh@nginx.com    && adduser \
55*1958Sthresh@nginx.com         --system \
56*1958Sthresh@nginx.com         --disabled-login \
57*1958Sthresh@nginx.com         --ingroup unit \
58*1958Sthresh@nginx.com         --no-create-home \
59*1958Sthresh@nginx.com         --home /nonexistent \
60*1958Sthresh@nginx.com         --gecos "unit user" \
61*1958Sthresh@nginx.com         --shell /bin/false \
62*1958Sthresh@nginx.com         unit \
63*1958Sthresh@nginx.com    && apt update \
64*1958Sthresh@nginx.com    && apt --no-install-recommends --no-install-suggests -y install curl $(cat /requirements.apt) \
65*1958Sthresh@nginx.com    && apt-get clean && rm -rf /var/lib/apt/lists/* \
66*1958Sthresh@nginx.com    && rm -f /requirements.apt \
67*1958Sthresh@nginx.com    && ln -sf /dev/stdout /var/log/unit.log
68*1958Sthresh@nginx.com
69*1958Sthresh@nginx.comSTOPSIGNAL SIGTERM
70*1958Sthresh@nginx.com
71*1958Sthresh@nginx.comENTRYPOINT ["/usr/local/bin/docker-entrypoint.sh"]
72*1958Sthresh@nginx.com
73*1958Sthresh@nginx.comCMD ["unitd", "--no-daemon", "--control", "unix:/var/run/control.unit.sock"]
74