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