EasySwoole框架的Dockerfile

此Dockerfile为在官方基础上修改的,亲测可用

FROM centos:7
MAINTAINER "QianLong <838808603@qq.com>"
#version defined
ENV SWOOLE_VERSION 4.4.7
ENV EASYSWOOLE_VERSION 3.x-dev
VOLUME ["/data","/data"]

#install libs
RUN yum update -y \
    && yum install -y curl zip unzip wget openssl openssl-devel gcc-c++ make autoconf \
    && yum install -y epel-release

#install php
RUN rpm -Uvh https://mirror.webtatic.com/yum/el7/webtatic-release.rpm \
    && rpm -ivh http://rpms.famillecollet.com/enterprise/remi-release-7.rpm
RUN yum clean all \
    && yum update -y \
    && yum install -y php72w-devel php72w-pecl-crypto php72w-gd php72w-mbstring php72w-mysqlnd

# composer
RUN curl -sS https://getcomposer.org/installer | php \
    && mv composer.phar /usr/bin/composer \
    && composer self-update --clean-backups \
    && composer config -g repo.packagist composer https://mirrors.aliyun.com/composer/

# swoole ext
RUN wget https://github.com/swoole/swoole-src/archive/v${SWOOLE_VERSION}.tar.gz -O swoole.tar.gz \
    && mkdir -p swoole \
    && tar -xf swoole.tar.gz -C swoole --strip-components=1 \
    && rm swoole.tar.gz \
    && ( \
    cd swoole \
    && phpize \
    && ./configure --enable-openssl \
    && make \
    && make install \
    ) \
    && sed -i "2i extension=swoole.so" /etc/php.ini \
    && rm -r swoole

# Dir
WORKDIR /apiswoole

# install easyswoole

RUN cd /apiswoole \
    && composer require easyswoole/easyswoole=${EASYSWOOLE_VERSION} \
    && php vendor/bin/easyswoole install
    # && php easyswoole start

EXPOSE 9501

CMD ["php", "easyswoole", "start", "-d"]
点赞

发表评论

电子邮件地址不会被公开。 必填项已用*标注