Docker安裝php安裝yaf擴展

Dockerfile文件內容:

# 從官方基礎版本構建
FROM php:7.3.7-fpm
# 官方版本默認安裝擴展:
# Core, ctype, curl
# date, dom
# fileinfo, filter, ftp
# hash
# iconv
# json
# libxml
# mbstring, mysqlnd
# openssl
# pcre, PDO, pdo_sqlite, Phar, posix
# readline, Reflection, session, SimpleXML, sodium, SPL, sqlite3, standard
# tokenizer
# xml, xmlreader, xmlwriter
# zlib
# 更新爲國內鏡像
COPY zhongkeda.list /etc/apt/sources.list
RUN  apt-get update
# bcmath, calendar, exif, gettext, sockets, dba,
# mysqli, pcntl, pdo_mysql, shmop, sysvmsg, sysvsem, sysvshm 擴展
RUN docker-php-ext-install -j$(nproc) bcmath calendar exif gettext sockets dba mysqli pcntl pdo_mysql shmop sysvmsg sysvsem sysvshm iconv
# GD 擴展
RUN apt-get install -y --no-install-recommends libfreetype6-dev libjpeg62-turbo-dev libpng-dev \
    && rm -r /var/lib/apt/lists/* \
    && docker-php-ext-configure gd --with-freetype-dir=/usr/include/ --with-jpeg-dir=/usr/include/ \
    && docker-php-ext-install -j$(nproc) gd
# redis 擴展
RUN pecl install redis-5.0.0 && docker-php-ext-enable redis
# opcache 擴展
RUN docker-php-ext-configure opcache --enable-opcache && docker-php-ext-install opcache
# xdebug 擴展
RUN pecl install xdebug-2.7.2 && docker-php-ext-enable xdebug
# swoole 擴展
RUN pecl install swoole-4.4.0 && docker-php-ext-enable swoole
# yaf 擴展
RUN pecl install yaf-3.0.8 && docker-php-ext-enable yaf
# 鏡像信息
LABEL Author="Stone"
LABEL Version="2019.7"
LABEL Description="PHP 7.3.7 開發環境鏡像."

zhongkeda.list文件內容:

deb http://mirrors.ustc.edu.cn/debian stable main contrib non-free
deb-src http://mirrors.ustc.edu.cn/debian stable main contrib non-free
deb http://mirrors.ustc.edu.cn/debian stable-proposed-updates main contrib non-free
deb-src http://mirrors.ustc.edu.cn/debian stable-proposed-updates main contrib non-free

啓動

docker build -t php73 .
//啓動一次
docker run --name php73 -d \
    -v /data/code:/data/code \
    -v /data/soft/lnmp/php73/etc:/usr/local/etc \
    -p 9000:9000 \
    php73
//把php配置文件複製出來
docker cp php73:/usr/local/etc /data/soft/lnmp/php73/etc
// /data/code/ 代碼目錄 /data/soft/lnmp/php73/etc php配置文件目錄
docker run --name php73 -d \
    -v /data/code:/data/code \
    -v /data/soft/lnmp/php73/etc:/usr/local/etc \
    -p 9000:9000 \
    php73
相關文章
相關標籤/搜索