包含了基础的库,ssh 服务,composer
FROM centos:8 #version defined ENV SWOOLE_VERSION 4.4.23 #install libs RUN yum -y update RUN yum install -y curl zip unzip wget openssl-devel gcc-c++ make autoconf git passwd #install php RUN rpm -Uvh https://dl.fedoraproject.org/pub/epel/epel-release-latest-8.noarch.rpm RUN rpm -Uvh http://rpms.remirepo.net/enterprise/remi-release-8.rpm RUN yum install -y php74 php74-php php74-php-devel php74-php-bcmath php74-php-cli php74-php-common php74-php-gd php74-php-json php74-php-mbstring php74-php-xml RUN rm -rf /usr/bin/php && ln -s /opt/remi/php74/root/usr/bin/php /usr/bin/php\ && rm -rf /usr/bin/phpize && ln -s /opt/remi/php74/root/usr/bin/phpize /usr/bin/phpize\ && rm -rf /usr/bin/php-config && ln -s /opt/remi/php74/root/usr/bin/php-config /usr/bin/php-config # composer RUN curl -sS https://getcomposer.org/installer | php \ && mv composer.phar /usr/bin/composer && chmod +x /usr/bin/composer # use aliyun composer RUN composer config -g repo.packagist composer https://mirrors.aliyun.com/composer/ CMD \["systemctl","restart","sshd"\] #安装ssh服务 RUN yum install -y openssh-server RUN mkdir -p /var/run/sshd RUN mkdir -p /root/.ssh #取消pam限制 RUN sed -ri \ "s/session required pam\_loginuid.so/#session required pam\_loginuid.so/g" /etc/pam.d/sshd 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" \`php -i | grep php.ini | awk -F "=>" '{print $2}' |grep php.ini\` \ && rm -r swoole # Dir VOLUME /work WORKDIR /work
EXPOSE 9501 22