Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
chendelin1982 authored Oct 26, 2024
1 parent 2fa2b2d commit 5988d67
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 10 deletions.
20 changes: 13 additions & 7 deletions apps/php/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
ARG PHP_VERSION
ARG PHP_VERSION=8.0-apache

FROM php:${PHP_VERSION}

Expand All @@ -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
Expand All @@ -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
RUN /usr/local/bin/php_install.sh

RUN apt clean
3 changes: 2 additions & 1 deletion apps/php/src/extensions.ini
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,5 @@ install-php-extensions=@composer,mysqli
docker-php-ext-install=bcmath

# Install PHP extension by php official pecl cli:
pecl=redis
# Add your pecl like this: pecl=redis,mysqli
pecl=
5 changes: 4 additions & 1 deletion apps/php/src/php_install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -20,12 +21,14 @@ 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
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
2 changes: 1 addition & 1 deletion apps/php/variables.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": {
Expand Down

0 comments on commit 5988d67

Please sign in to comment.