From 8b878b603aa56597fe0486ab57df2f6c06821b36 Mon Sep 17 00:00:00 2001 From: Yu Sun Date: Wed, 28 Sep 2022 18:49:07 +0800 Subject: [PATCH] =?UTF-8?q?fix(Image):=E6=89=8B=E5=8A=A8=E7=BC=96=E8=AF=91?= =?UTF-8?q?event=E6=89=A9=E5=B1=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .dockerignore | 3 ++ Dockerfile | 81 ++++++++++++++++++++++++++++++++++++--------------- 2 files changed, 60 insertions(+), 24 deletions(-) diff --git a/.dockerignore b/.dockerignore index 72e8ffc..9cb6cc4 100644 --- a/.dockerignore +++ b/.dockerignore @@ -1 +1,4 @@ * +!/EdgeManager/ +!EdgeManager.php +!composer* diff --git a/Dockerfile b/Dockerfile index c20eb49..1cb8884 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,28 +1,61 @@ -FROM alpine:latest +FROM alpine:3.15 -ENV TZ=Asia/Shanghai -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 +ADD https://php.hernandev.com/key/php-alpine.rsa.pub /etc/apk/keys/php-alpine.rsa.pub -RUN apk --no-cache add php81 \ - php81-posix \ - php81-pcntl \ - php81-pgsql \ - php81-openssl \ - php81-mbstring \ - php81-curl \ - php81-phar \ - php81-pecl-event \ - && ln -s /usr/bin/php81 /usr/local/bin/php +RUN apk add ca-certificates \ + && echo -e '\ +https://mirrors.ustc.edu.cn/alpine/latest-stable/main\n\ +https://mirrors.ustc.edu.cn/alpine/latest-stable/community\n\ +https://php.hernandev.com/v3.15/php-8.1\ +' > /etc/apk/repositories \ + && apk update \ + && apk add \ + tzdata \ + 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 \ - && curl -s https://mirrors.aliyun.com/composer/composer.phar -o /usr/local/bin/composer \ - && chmod +x /usr/local/bin/composer \ - && composer config -g repo.packagist composer https://mirrors.aliyun.com/composer/ \ - && apk del curl +RUN printf "\n\n\n\n\nno\nyes\n\n" | pecl install event \ + && echo "extension=event.so" > /etc/php8/conf.d/02_event.ini -WORKDIR /EdgeManager \ No newline at end of file +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/*