Skip to content

Commit

Permalink
feat: upgrade to PHP 8.2 (api-platform#2344)
Browse files Browse the repository at this point in the history
  • Loading branch information
dunglas committed Dec 20, 2022
1 parent 324cf79 commit c46947d
Show file tree
Hide file tree
Showing 3 changed files with 344 additions and 300 deletions.
53 changes: 14 additions & 39 deletions api/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,15 @@
# Adapted from https://github.com/dunglas/symfony-docker

# Prod image
FROM php:8.1-fpm-alpine AS app_php
FROM php:8.2-fpm-alpine AS app_php

ENV APP_ENV=prod

WORKDIR /srv/app

# php extensions installer: https://github.com/mlocati/docker-php-extension-installer
COPY --from=mlocati/php-extension-installer --link /usr/bin/install-php-extensions /usr/local/bin/

# persistent / runtime deps
RUN apk add --no-cache \
acl \
Expand All @@ -18,44 +21,19 @@ RUN apk add --no-cache \
;

RUN set -eux; \
apk add --no-cache --virtual .build-deps \
$PHPIZE_DEPS \
icu-data-full \
icu-dev \
libzip-dev \
zlib-dev \
; \
\
docker-php-ext-configure zip; \
docker-php-ext-install -j$(nproc) \
intl \
zip \
; \
pecl install \
apcu \
; \
pecl clear-cache; \
docker-php-ext-enable \
apcu \
install-php-extensions \
intl \
zip \
apcu \
opcache \
; \
\
runDeps="$( \
scanelf --needed --nobanner --format '%n#p' --recursive /usr/local/lib/php/extensions \
| tr ',' '\n' \
| sort -u \
| awk 'system("[ -e /usr/local/lib/" $1 " ]") == 0 { next } { print "so:" $1 }' \
)"; \
apk add --no-cache --virtual .app-phpexts-rundeps $runDeps; \
\
apk del .build-deps
;

###> recipes ###
###> doctrine/doctrine-bundle ###
RUN apk add --no-cache --virtual .pgsql-deps postgresql-dev; \
docker-php-ext-install -j$(nproc) pdo_pgsql; \
apk add --no-cache --virtual .pgsql-rundeps so:libpq.so.5; \
apk del .pgsql-deps
RUN set -eux; \
install-php-extensions \
pdo_pgsql \
;
###< doctrine/doctrine-bundle ###
###< recipes ###

Expand Down Expand Up @@ -113,10 +91,7 @@ RUN rm $PHP_INI_DIR/conf.d/app.prod.ini; \
COPY --link docker/php/conf.d/app.dev.ini $PHP_INI_DIR/conf.d/

RUN set -eux; \
apk add --no-cache --virtual .build-deps $PHPIZE_DEPS; \
pecl install xdebug; \
docker-php-ext-enable xdebug; \
apk del .build-deps
install-php-extensions xdebug

RUN rm -f .env.local.php

Expand Down
2 changes: 1 addition & 1 deletion api/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"type": "project",
"license": "MIT",
"require": {
"php": ">=8.1",
"php": ">=8.2",
"ext-ctype": "*",
"ext-iconv": "*",
"api-platform/core": "^3.0",
Expand Down
Loading

0 comments on commit c46947d

Please sign in to comment.