diff --git a/apps/php/Dockerfile b/apps/php/Dockerfile index 48478557..391a28cb 100644 --- a/apps/php/Dockerfile +++ b/apps/php/Dockerfile @@ -1,4 +1,4 @@ -ARG PHP_VERSION +ARG PHP_VERSION=8.0-apache FROM php:${PHP_VERSION} @@ -12,11 +12,15 @@ LABEL org.opencontainers.image.authors="https://www.websoft9.com" \ # Set environment variables to avoid interactive configuration ENV DEBIAN_FRONTEND=noninteractive -# Install necessary tools, including crudini -RUN apt-get update && \ - apt-get install -y \ - crudini \ - && apt-get clean + +# replace apt repository for php7.0/5.6 image +RUN sed -i 's|deb http://deb.debian.org/debian stretch|deb http://archive.debian.org/debian stretch|g' /etc/apt/sources.list && \ + sed -i '/stretch-updates/d' /etc/apt/sources.list && \ + sed -i 's|deb http://security.debian.org/debian-security stretch/updates|deb http://archive.debian.org/debian-security stretch/updates|g' /etc/apt/sources.list && \ + apt update + +RUN apt install -y crudini + COPY src/extensions.ini /usr/local/bin/config.ini COPY src/apt_install.sh /usr/local/bin/apt_install.sh @@ -26,4 +30,6 @@ RUN chmod +x /usr/local/bin/apt_install.sh RUN chmod +x /usr/local/bin/php_install.sh RUN /usr/local/bin/apt_install.sh -RUN /usr/local/bin/php_install.sh \ No newline at end of file +RUN /usr/local/bin/php_install.sh + +RUN apt clean \ No newline at end of file diff --git a/apps/php/src/extensions.ini b/apps/php/src/extensions.ini index ffcc746d..86f68f9a 100644 --- a/apps/php/src/extensions.ini +++ b/apps/php/src/extensions.ini @@ -12,4 +12,5 @@ install-php-extensions=@composer,mysqli docker-php-ext-install=bcmath # Install PHP extension by php official pecl cli: -pecl=redis \ No newline at end of file +# Add your pecl like this: pecl=redis,mysqli +pecl= \ No newline at end of file diff --git a/apps/php/src/php_install.sh b/apps/php/src/php_install.sh index ee6cc7b7..07bf635a 100644 --- a/apps/php/src/php_install.sh +++ b/apps/php/src/php_install.sh @@ -12,6 +12,7 @@ phpExtensions=$(echo "$phpExtensions" | tr ',' ' ') for extension in $phpExtensions; do echo "Start to install $extension by install-php-extensions" install-php-extensions $extension + docker-php-ext-enable $extension done # Install PHP extension by docker-php-ext-install @@ -20,6 +21,7 @@ dockerExtensions=$(echo "$dockerExtensions" | tr ',' ' ') for extension in $dockerExtensions; do echo "Start to install $extension by docker-php-ext-install" docker-php-ext-install $extension + docker-php-ext-enable $extension done # Install PHP extension by pecl @@ -27,5 +29,6 @@ peclExtensions=$(crudini --get "$INI_FILE" php-extension pecl) peclExtensions=$(echo "$peclExtensions" | tr ',' ' ') for extension in $peclExtensions; do echo "Start to install $extension by pecl" - echo "no" | pecl install $extension && docker-php-ext-enable $extension + yes '' | pecl install $extension + docker-php-ext-enable $extension done \ No newline at end of file diff --git a/apps/php/variables.json b/apps/php/variables.json index 36820ca8..835cd45c 100644 --- a/apps/php/variables.json +++ b/apps/php/variables.json @@ -7,7 +7,7 @@ "edition": [ { "dist": "community", - "version": ["8.3-apache","8.2-apache","8.1-apache","8.0-apache","7.4-apache","7.3-apache","7.2-apache","7.1-apache","7.0-apache","5.6-apache"] + "version": ["8.3-apache","8.2-apache","8.1-apache","8.0-apache8.0-apache","7.4-apache","7.3-apache","7.2-apache","7.1-apache","7.0-apache","5.6-apache"] } ], "requirements": {