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
|
|
|
|
|
|
|
|
|
|
|
|
RUN if [ $CONTAINER_PACKAGE_URL ] ; then sed -i "s/dl-cdn.alpinelinux.org/${CONTAINER_PACKAGE_URL}/g" /etc/apk/repositories ; fi
|
|
|
|
|
2023-09-12 13:07:56 +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 \
|
|
|
|
&& sh install.sh \
|
|
|
|
&& rm -rf /tmp/extensions
|
|
|
|
|
2023-11-30 17:52:26 +08:00
|
|
|
|
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-12-05 15:24:17 +08:00
|
|
|
RUN if [ $INSTALL_SUPERVISOR = 1 ] ; then \
|
|
|
|
apk add --no-cache supervisor && \
|
|
|
|
mkdir -p /var/log/supervisor ; \
|
|
|
|
fi
|
2023-04-09 10:55:06 +08:00
|
|
|
|
|
|
|
# Fix: https://github.com/docker-library/php/issues/240
|
|
|
|
RUN apk add gnu-libiconv libstdc++ --no-cache --repository http://${CONTAINER_PACKAGE_URL}/alpine/edge/community/ --allow-untrusted
|
|
|
|
ENV LD_PRELOAD /usr/lib/preloadable_libiconv.so php
|
|
|
|
|
|
|
|
|
|
|
|
# Install composer and change it's cache home
|
|
|
|
RUN curl -o /usr/bin/composer https://mirrors.aliyun.com/composer/composer.phar \
|
|
|
|
&& chmod +x /usr/bin/composer
|
|
|
|
ENV COMPOSER_HOME=/tmp/composer
|
|
|
|
|
|
|
|
# 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
|