fix(Image):手动编译event扩展

This commit is contained in:
Yu Sun
2022-09-28 18:49:07 +08:00
parent cec792f425
commit 8b878b603a
2 changed files with 60 additions and 24 deletions

View File

@@ -1 +1,4 @@
* *
!/EdgeManager/
!EdgeManager.php
!composer*

View File

@@ -1,28 +1,61 @@
FROM alpine:latest FROM alpine:3.15
ENV TZ=Asia/Shanghai ADD https://php.hernandev.com/key/php-alpine.rsa.pub /etc/apk/keys/php-alpine.rsa.pub
RUN echo 'https://mirrors.ustc.edu.cn/alpine/latest-stable/main/' > /etc/apk/repositories \
&& echo 'https://mirrors.ustc.edu.cn/alpine/latest-stable/community/' >> /etc/apk/repositories \
&& apk update \
&& apk add alpine-conf \
&& /sbin/setup-timezone -z $TZ \
&& apk del alpine-conf
RUN apk --no-cache add php81 \ RUN apk add ca-certificates \
php81-posix \ && echo -e '\
php81-pcntl \ https://mirrors.ustc.edu.cn/alpine/latest-stable/main\n\
php81-pgsql \ https://mirrors.ustc.edu.cn/alpine/latest-stable/community\n\
php81-openssl \ https://php.hernandev.com/v3.15/php-8.1\
php81-mbstring \ ' > /etc/apk/repositories \
php81-curl \ && apk update \
php81-phar \ && apk add \
php81-pecl-event \ tzdata \
&& ln -s /usr/bin/php81 /usr/local/bin/php php \
php-pgsql \
# event扩展运行时需要
php-sockets \
# 以下两件为workerman运行时需要
# https://github.com/walkor/workerman/issues/8
php-posix \
php-pcntl \
# 安装event扩展需要pecl
php-pear \
# 提供phpize
php-dev \
# 编译event扩展需要
autoconf \
# 以下两件足以在alpine里提供一般C编译环境
# g++则会提供gcc、musl-dev、libc-dev和g++,有点冗余
gcc \
musl-dev \
libevent-dev \
make \
composer \
&& cp /usr/share/zoneinfo/Asia/Shanghai /etc/localtime \
&& echo "Asia/Shanghai" > /etc/timezone \
&& ln -s /usr/bin/php8 /usr/bin/php
RUN apk --no-cache add curl \ RUN printf "\n\n\n\n\nno\nyes\n\n" | pecl install event \
&& curl -s https://mirrors.aliyun.com/composer/composer.phar -o /usr/local/bin/composer \ && echo "extension=event.so" > /etc/php8/conf.d/02_event.ini
&& chmod +x /usr/local/bin/composer \
&& composer config -g repo.packagist composer https://mirrors.aliyun.com/composer/ \
&& apk del curl
WORKDIR /EdgeManager COPY . /EdgeManager
WORKDIR /EdgeManager
RUN composer config -g repo.packagist composer https://mirrors.aliyun.com/composer/ \
&& composer u --no-cache
RUN apk del \
tzdata \
composer \
ca-certificates \
php-pear \
php-dev \
autoconf \
gcc \
musl-dev \
make \
&& rm -rf /var/cache/apk/* \
/etc/apk/keys/php-alpine.rsa.pub \
/tmp/*