ldc-web-images-docker/PHP8.5/CI/Dockerfile
2026-09-16 16:31:26 +02:00

99 lines
2.2 KiB
Docker

# Stage 1 : PHP build
# php:8.5.10-alpine amd64
FROM php@sha256:458a35f5b39d64293acde1c7cdc3af19864e60929570cc329fc44d7a5d45ae9e AS builder
ARG http_proxy
ENV http_proxy=${http_proxy} \
https_proxy=${http_proxy} \
HTTP_PROXY=${http_proxy} \
HTTPS_PROXY=${http_proxy}
RUN apk add --no-cache \
$PHPIZE_DEPS \
linux-headers \
zlib-dev \
libpng-dev \
libjpeg-turbo-dev \
freetype-dev \
icu-dev \
gmp-dev \
libxslt-dev \
gettext-dev \
git
RUN docker-php-ext-configure gd \
--with-freetype \
--with-jpeg \
&& docker-php-ext-install -j"$(nproc)" \
bcmath \
exif \
gd \
gettext \
gmp \
intl \
xsl
# pinned PCOV install
ARG PCOV_COMMIT=e8b16fae2dbb56e1cfd6f2be6d56c74c4eb1823b
RUN mkdir -p /tmp/pcov \
&& cd /tmp/pcov \
&& git init \
&& git remote add origin https://github.com/krakjoe/pcov.git \
&& git fetch --depth 1 origin "${PCOV_COMMIT}" \
&& git checkout FETCH_HEAD \
&& phpize \
&& ./configure \
&& make -j"$(nproc)" \
&& make install \
&& strip --strip-all /usr/local/lib/php/extensions/no-debug-non-zts-*/*.so \
&& rm -rf /tmp/pcov
# Stage 2 : Image Build
# php:8.5.10-alpine amd64
FROM php@sha256:458a35f5b39d64293acde1c7cdc3af19864e60929570cc329fc44d7a5d45ae9e
# Composer install
COPY --from=composer/composer:2-bin /composer /usr/local/bin/composer
# Rumtime libs + git + tini for entry point
RUN apk add --no-cache \
git \
tini \
freetype \
libjpeg-turbo \
libpng \
icu-libs \
gmp \
libxslt \
libintl \
# Php mininal configuration
&& printf '# composer php cli ini settings\ndate.timezone=UTC\nmemory_limit=-1\n' > "$PHP_INI_DIR/php-cli.ini"
ENV COMPOSER_ALLOW_SUPERUSER=1 \
COMPOSER_HOME=/tmp
# Git owner ship fix
RUN git config --global --add safe.directory '*'
# Copy php extensions
COPY --from=builder /usr/local/lib/php/extensions/ /usr/local/lib/php/extensions/
RUN docker-php-ext-enable \
bcmath \
exif \
gd \
gettext \
gmp \
intl \
xsl \
pcov
# Copy entry point
COPY docker-entrypoint.sh /docker-entrypoint.sh
RUN chmod +x /docker-entrypoint.sh
WORKDIR /project
ENTRYPOINT ["/docker-entrypoint.sh"]
CMD ["composer"]