Upgrade chill_base_php image to PHP8: install deps and php extension

This commit is contained in:
Mathieu Jaumotte 2023-01-31 16:50:28 +01:00
parent da2149cb60
commit a4fd3dbeb6

View File

@ -1,4 +1,4 @@
FROM php:7.4-fpm-buster AS chill_base_php
FROM php:8.2-fpm-alpine AS chill_base_php82
ENV POSTGRES_VERSION 14
@ -6,73 +6,83 @@ ENV POSTGRES_VERSION 14
ARG UID=1000
ARG GID=1000
RUN apt update && apt -y --no-install-recommends install wget gnupg \
&& wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | apt-key add - \
&& echo "deb http://apt.postgresql.org/pub/repos/apt/ buster-pgdg main" > /etc/apt/sources.list.d/pgdg.list \
&& apt update && apt -y --no-install-recommends install \
libicu-dev \
g++ \
postgresql-server-dev-$POSTGRES_VERSION \
libzip-dev libzip4 unzip \
libfreetype6-dev \
libonig-dev `# install oniguruma, required for mbstring` \
libpng-dev \
libjpeg62-turbo-dev \
git \
&& docker-php-ext-configure gd --with-freetype --with-jpeg \
&& docker-php-ext-install -j$(nproc) gd \
&& docker-php-ext-install intl pdo_pgsql mbstring zip bcmath sockets exif \
# install php extensions and deps
RUN apk update && apk add --no-cache \
wget gnupg \
libpq-dev \
icu-dev \
oniguruma-dev \
libzip-dev \
linux-headers \
gcc g++ make autoconf \
bash git \
&& docker-php-ext-install pdo_pgsql intl mbstring zip bcmath exif sockets \
&& git clone https://github.com/nikic/php-ast.git \
&& cd php-ast \
&& phpize \
&& ./configure \
&& make install \
&& echo 'extension=ast.so' > /usr/local/etc/php/php.ini \
&& cd .. && rm -rf php-ast \
&& pecl install redis \
&& docker-php-ext-enable redis \
&& apt remove -y wget libicu-dev g++ gnupg libzip-dev \
&& apt autoremove -y \
&& apt purge -y
&& apk add libpng-dev libjpeg-turbo-dev freetype-dev \
&& docker-php-ext-configure gd --with-freetype --with-jpeg \
&& docker-php-ext-install -j$(nproc) gd \
&& apk del wget gnupg g++ icu-dev libzip-dev
RUN { \
echo ""; \
echo "memory_limit = 512M"; \
echo ""; \
} >> /usr/local/etc/php/conf.d/memory_limit.ini
RUN apk del oniguruma-dev linux-headers gcc make autoconf
RUN { \
echo ""; \
echo "[Date]"; \
echo "date.timezone = Europe/Brussels"; \
echo ""; \
} >> /usr/local/etc/php/conf.d/date.ini
# "ERROR: Package cache is not enabled." \
# https://github.com/gliderlabs/docker-alpine/issues/224
#RUN apk cache clean
COPY --from=composer:2 /usr/bin/composer /usr/bin/composer
ENV COMPOSER_ALLOW_SUPERUSER=1
ENV COMPOSER_MEMORY_LIMIT=-1
WORKDIR /var/www/app
CMD ["php-fpm"]
FROM chill_base_php AS chill_php
# copy directories
COPY ./bin /var/www/app/bin/.
COPY ./composer.* /var/www/app/
COPY ./config /var/www/app/config/.
COPY ./migrations /var/www/app/migrations/.
COPY ./public /var/www/app/public/.
COPY ./src /var/www/app/src/.
COPY ./templates /var/www/app/templates/.
COPY ./translations /var/www/app/translations/.
COPY ./vendor /var/www/app/vendor/.
COPY ./.env /var/www/app/.env
# import the manifest.json file
COPY ./public/build/manifest.json /var/www/app/public/build/manifest.json
ADD ./entrypoint.sh /.
RUN chmod +x /entrypoint.sh
ENTRYPOINT ["/entrypoint.sh"]
#RUN { \
# echo ""; \
# echo "memory_limit = 512M"; \
# echo ""; \
# } >> /usr/local/etc/php/conf.d/memory_limit.ini
#
#RUN { \
# echo ""; \
# echo "[Date]"; \
# echo "date.timezone = Europe/Brussels"; \
# echo ""; \
# } >> /usr/local/etc/php/conf.d/date.ini
#
#COPY --from=composer:2 /usr/bin/composer /usr/bin/composer
#ENV COMPOSER_ALLOW_SUPERUSER=1
#ENV COMPOSER_MEMORY_LIMIT=-1
#
#WORKDIR /var/www/app
#
#CMD ["php-fpm"]
#
#FROM chill_base_php82 AS chill_php82
#
## copy directories
#
#COPY ./bin /var/www/app/bin/.
#COPY ./composer.* /var/www/app/
#COPY ./config /var/www/app/config/.
#COPY ./migrations /var/www/app/migrations/.
#COPY ./public /var/www/app/public/.
#COPY ./src /var/www/app/src/.
#COPY ./templates /var/www/app/templates/.
#COPY ./translations /var/www/app/translations/.
#COPY ./vendor /var/www/app/vendor/.
#
#COPY ./.env /var/www/app/.env
#
## import the manifest.json file
#COPY ./public/build/manifest.json /var/www/app/public/build/manifest.json
#
#ADD ./entrypoint.sh /.
#
#RUN chmod +x /entrypoint.sh
#
#ENTRYPOINT ["/entrypoint.sh"]
ENV PHP_FPM_USER=www-data \
PHP_FPM_GROUP=www-data \