11# syntax=docker/dockerfile:experimental
2- FROM php:7.4-zts-buster AS build-parallel
3- RUN apt-get update && \
4- yes | apt-get install $PHPIZE_DEPS git
2+ FROM php:7.4-zts-buster AS base
3+
4+ # Build-time metadata as defined at http://label-schema.org
5+ LABEL org.label-schema.name="wyrihaximusnet/php" \
6+ org.label-schema.description="Opinionated ReactPHP optimised PHP Docker images" \
7+ org.label-schema.url="https://github.com/wyrihaximusnet/docker-php" \
8+ org.label-schema.vcs-url="https://github.com/wyrihaximusnet/docker-php" \
9+ org.label-schema.vendor="WyriHaximus.net" \
10+ org.label-schema.schema-version="1.0"
11+
12+ RUN apt-get update \
13+ && yes | apt-get upgrade \
14+ && set -x \
15+ && addgroup --gid 1000 app \
16+ && adduser --uid 1000 --gid 1000 --disabled-password app \
17+ && touch /.you-are-in-a-wyrihaximus.net-php-docker-image
18+
19+ FROM base AS base-build
20+ RUN yes | apt-get install $PHPIZE_DEPS git libuv1-dev
21+
22+ FROM base-build AS build-parallel
523RUN git clone https://github.com/krakjoe/parallel
624WORKDIR /parallel
725RUN git fetch \
@@ -13,10 +31,8 @@ RUN git fetch \
1331 cp "$EXTENSION_DIR/parallel.so" /parallel.so
1432RUN sha256sum /parallel.so
1533
16- FROM php:7.4-zts-buster AS build-uv
17- RUN apt-get update && \
18- yes | apt-get install $PHPIZE_DEPS git libuv1-dev && \
19- git clone https://github.com/bwoebi/php-uv uv
34+ FROM base-build AS build-uv
35+ RUN git clone https://github.com/bwoebi/php-uv uv
2036WORKDIR /uv
2137RUN git fetch \
2238 && git pull \
@@ -27,31 +43,13 @@ RUN git fetch \
2743 cp "$EXTENSION_DIR/uv.so" /uv.so
2844RUN sha256sum /uv.so
2945
30- FROM php:7.4-zts-buster AS zts-slim-root
31-
32- # Build-time metadata as defined at http://label-schema.org
33- ARG BUILD_DATE
34- ARG VCS_REF
35- LABEL org.label-schema.build-date=$BUILD_DATE \
36- org.label-schema.name="wyrihaximusnet/php" \
37- org.label-schema.description="Opinionated ReactPHP optimised PHP Docker images" \
38- org.label-schema.url="https://github.com/wyrihaximusnet/docker-php" \
39- org.label-schema.vcs-ref=$VCS_REF \
40- org.label-schema.vcs-url="https://github.com/wyrihaximusnet/docker-php" \
41- org.label-schema.vendor="WyriHaximus.net" \
42- org.label-schema.schema-version="1.0"
43-
44- RUN set -x \
45- && addgroup --gid 1000 app \
46- && adduser --uid 1000 --gid 1000 --disabled-password app \
47- && touch /.you-are-in-a-wyrihaximus.net-php-docker-image
46+ FROM base AS zts-slim-root
4847
4948COPY --from=build-parallel /parallel.so /parallel.so
5049COPY --from=build-uv /uv.so /uv.so
5150
5251# Patch CVE-2018-14618 (curl), CVE-2018-16842 (libxml2), CVE-2019-1543 (openssl)
53- RUN apt-get update && \
54- yes | apt-get upgrade curl libxml2 openssl
52+ RUN yes | apt-get upgrade curl libxml2 openssl
5553
5654# Install docker help scripts
5755COPY src/php/utils/docker/debian/ /usr/local/bin/
@@ -61,8 +59,6 @@ COPY src/php/cli/conf/*.ini /usr/local/etc/php/conf.d/
6159
6260RUN EXTENSION_DIR=`php-config --extension-dir 2>/dev/null` && \
6361 mv /*.so "$EXTENSION_DIR/" && \
64- apt-get update && \
65- yes | apt-get upgrade && \
6662 yes | apt-get install \
6763 libgmp-dev \
6864 zlib1g-dev \
@@ -116,8 +112,7 @@ RUN dev-mode && rm -rf /usr/local/bin/dev-mode && rm -rf /usr/local/bin/docker-p
116112
117113# Install composer
118114COPY src/php/utils/install-composer /usr/local/bin/
119- RUN apt-get update \
120- && yes | apt-get install wget unzip \
115+ RUN yes | apt-get install wget unzip \
121116 && install-composer \
122117 && yes | apt-get purge wget \
123118 && yes | apt-get install make \
@@ -138,8 +133,7 @@ RUN dev-mode && rm -rf /usr/local/bin/dev-mode && rm -rf /usr/local/bin/docker-p
138133
139134# Install composer
140135COPY src/php/utils/install-composer /usr/local/bin/
141- RUN apt-get update \
142- && yes | apt-get install wget unzip \
136+ RUN yes | apt-get install wget unzip \
143137 && install-composer \
144138 && yes | apt-get purge wget \
145139 && yes | apt-get install make \
0 commit comments