2023-04-10 18:35:19 +08:00
ARG PHP_IMAGE
FROM ${PHP_IMAGE}
2023-04-09 10:55:06 +08:00
ARG TZ
ARG PHP_EXTENSIONS
ARG CONTAINER_PACKAGE_URL
2023-09-12 12:54:19 +08:00
RUN if [ " $CONTAINER_PACKAGE_URL " ] ; then sed -i " s|http://dl-cdn.alpinelinux.org/alpine/v3.4|https:// ${ CONTAINER_PACKAGE_URL } /alpine/v3.5|g " /etc/apk/repositories; fi
2023-04-09 10:55:06 +08:00
2023-05-04 18:05:22 +08:00
2023-09-12 12:54:19 +08:00
ADD ./extensions/install-php-extensions /usr/local/bin/
RUN chmod uga+x /usr/local/bin/install-php-extensions
2023-04-09 10:55:06 +08:00
COPY ./extensions /tmp/extensions
WORKDIR /tmp/extensions
RUN chmod +x install.sh \
2023-09-11 17:54:21 +08:00
&& sh install.sh
2023-04-09 10:55:06 +08:00
RUN apk --no-cache add tzdata \
&& cp " /usr/share/zoneinfo/ $TZ " /etc/localtime \
&& echo " $TZ " > /etc/timezone
2023-09-11 17:54:21 +08:00
# Fix: https://github.com/docker-library/php/issues/1121
RUN apk add --no-cache --repository http://${ CONTAINER_PACKAGE_URL } /alpine/v3.13/community/ gnu-libiconv= 1.15-r3
2023-04-09 10:55:06 +08:00
ENV LD_PRELOAD /usr/lib/preloadable_libiconv.so php
# Install composer and change it's cache home
2023-09-12 12:54:19 +08:00
RUN curl -ksS https://getcomposer.org/installer | php -- --install-dir= /usr/bin --filename= composer --disable-tls \
&& chmod +x /usr/bin/composer \
&& rm -rf /tmp/composer-setup.php
2023-04-09 10:55:06 +08:00
# php image's www-data user uid & gid are 82, change them to 1000 (primary user)
RUN apk --no-cache add shadow && usermod -u 1000 www-data && groupmod -g 1000 www-data
2023-09-11 17:54:21 +08:00
WORKDIR /www