|
1 |
| -FROM eclipse-temurin:11-jdk as BUILDER |
| 1 | +FROM eclipse-temurin:11-jdk-jammy |
2 | 2 |
|
3 |
| -LABEL maintainer="NGINX Docker Maintainers <docker-maint@nginx.com>" |
| 3 | +LABEL org.opencontainers.image.title="Unit" |
| 4 | +LABEL org.opencontainers.image.description="Official build of Unit for Docker." |
| 5 | +LABEL org.opencontainers.image.url="https://unit.nginx.org" |
| 6 | +LABEL org.opencontainers.image.source="https://github.com/nginx/unit" |
| 7 | +LABEL org.opencontainers.image.documentation="https://unit.nginx.org/installation/#docker-images" |
| 8 | +LABEL org.opencontainers.image.vendor="NGINX Docker Maintainers <docker-maint@nginx.com>" |
| 9 | +LABEL org.opencontainers.image.version="1.30.0" |
4 | 10 |
|
5 | 11 | RUN set -ex \
|
| 12 | + && savedAptMark="$(apt-mark showmanual)" \ |
6 | 13 | && apt-get update \
|
7 |
| - && apt-get install --no-install-recommends --no-install-suggests -y ca-certificates mercurial build-essential libssl-dev libpcre2-dev \ |
| 14 | + && apt-get install --no-install-recommends --no-install-suggests -y ca-certificates mercurial build-essential libssl-dev libpcre2-dev curl pkg-config \ |
8 | 15 | && mkdir -p /usr/lib/unit/modules /usr/lib/unit/debug-modules \
|
9 |
| - && hg clone https://hg.nginx.org/unit \ |
| 16 | + && hg clone -u 1.30.0-1 https://hg.nginx.org/unit \ |
10 | 17 | && cd unit \
|
11 |
| - && hg up 1.29.1 \ |
12 | 18 | && NCPU="$(getconf _NPROCESSORS_ONLN)" \
|
13 | 19 | && DEB_HOST_MULTIARCH="$(dpkg-architecture -q DEB_HOST_MULTIARCH)" \
|
14 | 20 | && CC_OPT="$(DEB_BUILD_MAINT_OPTIONS="hardening=+all,-pie" DEB_CFLAGS_MAINT_APPEND="-Wp,-D_FORTIFY_SOURCE=2 -fPIC" dpkg-buildflags --get CFLAGS)" \
|
15 | 21 | && LD_OPT="$(DEB_BUILD_MAINT_OPTIONS="hardening=+all,-pie" DEB_LDFLAGS_MAINT_APPEND="-Wl,--as-needed -pie" dpkg-buildflags --get LDFLAGS)" \
|
16 |
| - && CONFIGURE_ARGS="--prefix=/usr \ |
17 |
| - --state=/var/lib/unit \ |
| 22 | + && CONFIGURE_ARGS_MODULES="--prefix=/usr \ |
| 23 | + --statedir=/var/lib/unit \ |
18 | 24 | --control=unix:/var/run/control.unit.sock \
|
19 | 25 | --pid=/var/run/unit.pid \
|
20 | 26 | --log=/var/log/unit.log \
|
21 |
| - --tmp=/var/tmp \ |
| 27 | + --tmpdir=/var/tmp \ |
22 | 28 | --user=unit \
|
23 | 29 | --group=unit \
|
24 | 30 | --openssl \
|
25 | 31 | --libdir=/usr/lib/$DEB_HOST_MULTIARCH" \
|
26 |
| - && ./configure $CONFIGURE_ARGS --cc-opt="$CC_OPT" --ld-opt="$LD_OPT" --modules=/usr/lib/unit/debug-modules --debug \ |
| 32 | + && CONFIGURE_ARGS="$CONFIGURE_ARGS_MODULES \ |
| 33 | + --njs" \ |
| 34 | + && make -j $NCPU -C pkg/contrib .njs \ |
| 35 | + && export PKG_CONFIG_PATH=$(pwd)/pkg/contrib/njs/build \ |
| 36 | + && ./configure $CONFIGURE_ARGS --cc-opt="$CC_OPT" --ld-opt="$LD_OPT" --modulesdir=/usr/lib/unit/debug-modules --debug \ |
27 | 37 | && make -j $NCPU unitd \
|
28 |
| - && install -pm755 build/unitd /usr/sbin/unitd-debug \ |
| 38 | + && install -pm755 build/sbin/unitd /usr/sbin/unitd-debug \ |
29 | 39 | && make clean \
|
30 |
| - && ./configure $CONFIGURE_ARGS --cc-opt="$CC_OPT" --ld-opt="$LD_OPT" --modules=/usr/lib/unit/modules \ |
| 40 | + && ./configure $CONFIGURE_ARGS --cc-opt="$CC_OPT" --ld-opt="$LD_OPT" --modulesdir=/usr/lib/unit/modules \ |
31 | 41 | && make -j $NCPU unitd \
|
32 |
| - && install -pm755 build/unitd /usr/sbin/unitd \ |
| 42 | + && install -pm755 build/sbin/unitd /usr/sbin/unitd \ |
33 | 43 | && make clean \
|
34 |
| - && ./configure $CONFIGURE_ARGS --cc-opt="$CC_OPT" --modules=/usr/lib/unit/debug-modules --debug \ |
| 44 | + && ./configure $CONFIGURE_ARGS_MODULES --cc-opt="$CC_OPT" --modulesdir=/usr/lib/unit/debug-modules --debug \ |
35 | 45 | && ./configure java --jars=/usr/share/unit-jsc-common/ \
|
36 | 46 | && make -j $NCPU java-shared-install java-install \
|
37 | 47 | && make clean \
|
38 |
| - && ./configure $CONFIGURE_ARGS --cc-opt="$CC_OPT" --modules=/usr/lib/unit/modules \ |
| 48 | + && ./configure $CONFIGURE_ARGS_MODULES --cc-opt="$CC_OPT" --modulesdir=/usr/lib/unit/modules \ |
39 | 49 | && ./configure java --jars=/usr/share/unit-jsc-common/ \
|
40 | 50 | && make -j $NCPU java-shared-install java-install \
|
41 |
| - && 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 |
| - |
43 |
| -FROM eclipse-temurin:11-jdk |
44 |
| -COPY docker-entrypoint.sh /usr/local/bin/ |
45 |
| -COPY --from=BUILDER /usr/sbin/unitd /usr/sbin/unitd |
46 |
| -COPY --from=BUILDER /usr/sbin/unitd-debug /usr/sbin/unitd-debug |
47 |
| -COPY --from=BUILDER /usr/lib/unit/ /usr/lib/unit/ |
48 |
| -COPY --from=BUILDER /requirements.apt /requirements.apt |
49 |
| -COPY --from=BUILDER /usr/share/unit-jsc-common/ /usr/share/unit-jsc-common/ |
50 |
| -RUN set -x \ |
51 |
| - && if [ -f "/tmp/libunit.a" ]; then \ |
52 |
| - mv /tmp/libunit.a /usr/lib/$(dpkg-architecture -q DEB_HOST_MULTIARCH)/libunit.a; \ |
53 |
| - rm -f /tmp/libunit.a; \ |
54 |
| - fi \ |
| 51 | + && cd \ |
| 52 | + && rm -rf unit \ |
| 53 | + && for f in /usr/sbin/unitd /usr/lib/unit/modules/*.unit.so; do \ |
| 54 | + ldd $f | awk '/=>/{print $(NF-1)}' | while read n; do dpkg-query -S $n; done | sed 's/^\([^:]\+\):.*$/\1/' | sort | uniq >> /requirements.apt; \ |
| 55 | + done \ |
| 56 | + && apt-mark showmanual | xargs apt-mark auto > /dev/null \ |
| 57 | + && { [ -z "$savedAptMark" ] || apt-mark manual $savedAptMark; } \ |
| 58 | + && /bin/true \ |
55 | 59 | && mkdir -p /var/lib/unit/ \
|
56 | 60 | && mkdir /docker-entrypoint.d/ \
|
57 |
| - && addgroup --system unit \ |
58 |
| - && adduser \ |
59 |
| - --system \ |
60 |
| - --disabled-login \ |
61 |
| - --ingroup unit \ |
| 61 | + && groupadd --gid 999 unit \ |
| 62 | + && useradd \ |
| 63 | + --uid 999 \ |
| 64 | + --gid unit \ |
62 | 65 | --no-create-home \
|
63 | 66 | --home /nonexistent \
|
64 |
| - --gecos "unit user" \ |
| 67 | + --comment "unit user" \ |
65 | 68 | --shell /bin/false \
|
66 | 69 | unit \
|
67 |
| - && apt update \ |
68 |
| - && apt --no-install-recommends --no-install-suggests -y install curl $(cat /requirements.apt) \ |
69 |
| - && apt-get clean && rm -rf /var/lib/apt/lists/* \ |
| 70 | + && apt-get update \ |
| 71 | + && apt-get --no-install-recommends --no-install-suggests -y install curl $(cat /requirements.apt) \ |
| 72 | + && apt-get purge -y --auto-remove \ |
| 73 | + && rm -rf /var/lib/apt/lists/* \ |
70 | 74 | && rm -f /requirements.apt \
|
71 | 75 | && ln -sf /dev/stdout /var/log/unit.log
|
72 | 76 |
|
| 77 | +COPY docker-entrypoint.sh /usr/local/bin/ |
| 78 | +COPY welcome.* /usr/share/unit/welcome/ |
| 79 | + |
73 | 80 | STOPSIGNAL SIGTERM
|
74 | 81 |
|
75 | 82 | ENTRYPOINT ["/usr/local/bin/docker-entrypoint.sh"]
|
76 |
| - |
| 83 | +EXPOSE 80 |
77 | 84 | CMD ["unitd", "--no-daemon", "--control", "unix:/var/run/control.unit.sock"]
|
0 commit comments