90 lines
2.8 KiB
Plaintext
90 lines
2.8 KiB
Plaintext
# 拉基础镜像
|
||
FROM php:8.3-cli
|
||
|
||
# 替换源
|
||
RUN rm -rf /etc/apt/sources.list.d/debian.sources \
|
||
&& echo 'deb http://mirror.us.oneandone.net/debian bookworm main' > /etc/apt/sources.list \
|
||
&& echo 'deb-src http://mirror.us.oneandone.net/debian bookworm main' >> /etc/apt/sources.list \
|
||
&& apt-get update \
|
||
&& apt-get install -y netselect-apt \
|
||
&& netselect-apt --sources bookworm \
|
||
&& mv sources.list /etc/apt/ \
|
||
&& apt-get update
|
||
|
||
|
||
# socket event pcntl
|
||
RUN docker-php-ext-install sockets \
|
||
&& apt-get install -y libevent-dev \
|
||
&& printf "no\nyes\n/usr\nno\nyes\nno\nno\nyes\n" | pecl install https://pecl.php.net/get/event-3.1.4.tgz \
|
||
&& docker-php-ext-enable event \
|
||
&& cat /usr/local/etc/php/conf.d/docker-php-ext-event.ini >> /usr/local/etc/php/conf.d/docker-php-ext-sockets.ini \
|
||
&& mv /usr/local/etc/php/conf.d/docker-php-ext-sockets.ini /usr/local/etc/php/conf.d/docker-php-ext-event.ini \
|
||
&& docker-php-ext-install pcntl
|
||
|
||
# pdo_mysql mysqli opcache exif bcmath(任意精度的数学库)
|
||
RUN docker-php-ext-install pdo_mysql \
|
||
mysqli \
|
||
opcache \
|
||
exif \
|
||
bcmath
|
||
|
||
# gmp(大整数支持)
|
||
RUN apt-get install -y libgmp-dev \
|
||
&& docker-php-ext-install gmp
|
||
|
||
# gd
|
||
RUN apt-get install -y \
|
||
libfreetype6-dev \
|
||
libjpeg62-turbo-dev \
|
||
libpng-dev \
|
||
libwebp-dev \
|
||
&& docker-php-ext-configure gd --enable-gd --with-freetype --with-jpeg --with-webp \
|
||
&& docker-php-ext-install -j$(nproc) gd
|
||
|
||
# redis
|
||
RUN printf "no\nno\nno\nno\nno\nyes\n" | pecl install https://pecl.php.net/get/redis-6.1.0.tgz \
|
||
&& docker-php-ext-enable redis
|
||
|
||
# pdo_pgsql pgsql
|
||
RUN apt-get install -y libpq-dev \
|
||
&& docker-php-ext-install -j$(nproc) pgsql pdo_pgsql
|
||
|
||
# mongodb
|
||
RUN printf "no\nno\nno\nauto\nauto\nauto\nauto\nauto\nauto\nno\nbundled\n" | pecl install https://pecl.php.net/get/mongodb-1.19.3.tgz \
|
||
&& docker-php-ext-enable mongodb
|
||
|
||
# xlswriter
|
||
RUN printf "yes\n" | pecl install https://pecl.php.net/get/xlswriter-1.5.5.tgz \
|
||
&& docker-php-ext-enable xlswriter
|
||
|
||
# zip
|
||
RUN apt-get install -y libzip-dev zip \
|
||
&& docker-php-ext-install zip
|
||
|
||
# protobuf
|
||
RUN pecl install https://pecl.php.net/get/protobuf-4.29.1.tgz \
|
||
&& docker-php-ext-enable protobuf
|
||
|
||
# grpc(客户端)
|
||
RUN pecl install https://pecl.php.net/get/grpc-1.68.0.tgz \
|
||
&& docker-php-ext-enable grpc
|
||
|
||
# composer
|
||
RUN php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');" \
|
||
&& php composer-setup.php \
|
||
&& php -r "unlink('composer-setup.php');" \
|
||
&& mv composer.phar /usr/local/bin/composer
|
||
|
||
# swow(安装后默认不加载,使用php -d extension=swow在运行时加载)
|
||
RUN composer require swow/swow \
|
||
&& ./vendor/bin/swow-builder --install \
|
||
&& rm -rf vendor
|
||
|
||
RUN apt-get clean
|
||
|
||
# 创建应用目录
|
||
RUN mkdir -p /app
|
||
|
||
# 设置工作目录
|
||
WORKDIR /app
|