一、環境構築準備


1、目標を設定する
a.初期環境:
[注意:テストホストはソフトウェアソースが設定されており、仮想ホストのデフォルトはrootユーザーログインです]
[]:~/tmp# lsb_release -a
No LSB modules are available.
Distributor ID:    Debian
Description:    Debian GNU/Linux 9.9 (stretch)
Release:    9.9
Codename:    stretch
[]:~/tmp# 

b.目標環境:
[docker+]
    php-7.3.6
    redis-5.0.5 +  
    memcached-1.5.16
    openresty-1.15.8.1(nginx+lua)
    mysql-8.0.16 +  
    mongodb-4.0.10

2、前期準備
a.書類の準備
(mysqlはdebian、x 64、server版を選択)
https://www.php.net/distributions/php-7.3.6.tar.xz
http://download.redis.io/releases/redis-5.0.5.tar.gz
https://memcached.org/files/memcached-1.5.16.tar.gz
# https://dev.mysql.com/get/Downloads/MySQL-8.0/mysql-community-server-dbgsym_8.0.16-2debian9_amd64.deb
https://openresty.org/download/openresty-1.15.8.1.tar.gz
https://fastdl.mongodb.org/src/mongodb-src-r4.0.10.tar.gz

[ここは後期の注釈です]使っていませんが、文章は書きながら出しています.
b.依存準備
以前のコンパイルインストール時のパラメータ:
PHP:
apt-get install curl libxml2-dev libssl-dev libzip4 libzip-dev libbz2-dev libjpeg-dev libpng-dev libxpm-dev libfreetype6-dev libgmp-dev libgmp3-dev libcurl4-gnutls-dev librecode-dev libreadline-dev libtidy-dev libxslt1-dev -y
OpenResty:
apt-get install libpcre3-dev libssl-dev perl make build-essential curl -y

c.docker-ceインストールスクリプトの作成
環境構築にはdockerを使用し、対応する公式サイト「DebianインストールDocker」、「清華源を使用してdockerをインストールする」を参照してください.インストールスクリプトの準備:
[]:~/tmp# vim docker_install.sh
#!/bin/bash
#1.      
apt-get remove docker docker-engine docker.io
#2.     
apt-get install apt-transport-https ca-certificates curl gnupg2 software-properties-common -y
#3. 
curl -fsSL https://download.docker.com/linux/debian/gpg | sudo apt-key add -
#4. x86_64      
add-apt-repository "deb [arch=amd64] https://mirrors.tuna.tsinghua.edu.cn/docker-ce/linux/debian $(lsb_release -cs) stable"
#5.       
apt-get update && apt-get install docker-ce -y

最初のステップの準備が完了しました.
3、docker環境の構築
a.dockerを初期化する
[]:~/tmp# chmod +x docker_install.sh && ./docker_install.sh
#       
[]:~/tmp# docker pull php:7.3 && docker pull mysql:8.0 && docker pull redis:5.0

b.phpミラー作成
ターゲットは、公式にカスタムプラグインをインストールすることです.公式:『alpineインストールphp』を参照してください.
[]:~/tmp# mkdir -p dk/php
[]:~/tmp# vim dk/php/Dockerfile

# php7.3.5; Feb 7, 2019 link: https://github.com/docker-library/php/blob/master/7.3/alpine3.9/fpm/Dockerfile
# Base images     +   
FROM alpine:3.9

#MAINTAINER      
MAINTAINER [email protected]

# dependencies required for running "phpize"
ENV PHP_VERSION 7.3.6
ENV PHP_URL https://secure.php.net/get/php-$PHP_VERSION.tar.xz/from/this/mirror
ENV PHPIZE_DEPS \
        autoconf \
        dpkg-dev dpkg \
        file \
        g++ \
        gcc \
        libc-dev \
        make \
        pkgconf \
        re2c

RUN sed -i 's/dl-cdn.alpinelinux.org/mirrors.aliyun.com/g' /etc/apk/repositories \
    && apk update \
    && addgroup -g 82 -S web \
    && adduser -u 82 -D -S -G web web \
    && mkdir -p "/usr/local/etc/php/conf.d" && mkdir -p "/var/www/html" \
    && chown www-data:www-data /var/www/html && chmod 777 /var/www/html \
    && apk add --no-cache \
        ca-certificates \
        curl \
        tar \
        xz \
        openssl \
        wget \
    &&  apk add --no-cache --virtual .build-deps \
        $PHPIZE_DEPS \
        argon2-dev \
        coreutils \
        curl-dev \
        libedit-dev \
        libsodium-dev \
        libxml2-dev \
        openssl-dev \
        sqlite-dev \
        libjpeg-turbo-dev \
        libpng-dev \
        gd-dev \
        gettext-dev \
        freetype-dev \
        libxpm-dev

COPY php.tar.xz php.tar.xz
RUN set -x \
        #     
        # && wget -O php.tar.xz "$PHP_URL" \
        && tar -Jxf php.tar.xz && cd php-$PHP_VERSION && ./configure \
        --prefix="/usr/local/php" \
        --with-config-file-path="/usr/local/php/etc" \
        --with-config-file-scan-dir="/usr/local/php/etc/conf.d" \
        \
        --enable-option-checking=fatal \
        --with-mhash \
        \
        --enable-ftp \
        --enable-exif \
        --enable-mbregex \
        --enable-mbstring \
        --enable-mysqlnd \
        --enable-sysvmsg \
        --enable-opcache \
        --enable-pcntl \
        --enable-sockets \
        --enable-sysvsem \
        --enable-xml \
        --with-curl \
        --with-libedit \
        --with-openssl \
        --with-zlib \
        --with-pcre-regex \
        --with-pear \
        --with-libxml-dir=/usr \
        --with-gd=/usr \
        --with-jpeg-dir \
        --with-freetype-dir \
        --with-xpm-dir \
        --with-png-dir \
        --with-gettext \
        --with-mhash \
        --with-iconv \
        --disable-fileinfo \
        \
        --enable-fpm --with-fpm-user=web --with-fpm-group=www-data --disable-cgi \
    && make -j "$(nproc)" \
    && find -type f -name '*.a' -delete \
    && make install \
#    && make clean \
    && cd ../ && rm -rf php-$PHP_VERSION.tar.xz php-$PHP_VERSION

#      ,        ,    
RUN set -x \
    # libevent
    && wget "https://github.com/libevent/libevent/releases/download/release-2.1.8-stable/libevent-2.1.8-stable.tar.gz" \
        && tar -zxf libevent-2.1.8-stable.tar.gz && cd libevent-2.1.8-stable && ./configure --prefix=/usr && make && make install && cd ../ \
    && wget "http://pecl.php.net/get/event-2.4.3.tgz" && tar -zxf event-2.4.3.tgz && cd event-2.4.3 && /usr/local/php/bin/phpize \
        && ./configure --with-event-libevent-dir=/usr --with-php-config=/usr/local/php/bin/php-config && make && make install && cd ../ \
        && rm -rf libevent-2.1.8-stable.tar.gz libevent-2.1.8-stable event-2.4.3.tgz event-2.4.3 \
    \
    # libuuid
    && wget "http://nchc.dl.sourceforge.net/project/libuuid/libuuid-1.0.3.tar.gz" \
        && tar -zxf libuuid-1.0.3.tar.gz && cd libuuid-1.0.3 && ./configure --prefix=/usr && make && make install && cd ../ \
    && wget http://pecl.php.net/get/uuid-1.0.4.tgz && tar zxf uuid-1.0.4.tgz && cd uuid-1.0.4 && /usr/local/php/bin/phpize \
        && ./configure --with-php-config=/usr/local/php/bin/php-config && make && make install && cd ../ \
        && rm -rf libuuid-1.0.3.tar.gz libuuid-1.0.3 uuid-1.0.4.tgz uuid-1.0.4 \
    \
#        && wget "https://launchpad.net/libmemcached/1.0/1.0.18/+download/libmemcached-1.0.18.tar.gz" \
#           && tar -zxf libmemcached-1.0.18.tar.gz && cd libmemcached-1.0.18 && ./configure --prefix=/usr && make && make install && cd ../ \
#       && wget -O "http://pecl.php.net/get/memcached-3.1.3.tgz" \
#           && tar -zxf memcached-3.1.3 && cd memcached-3.1.3 && ./configure --with-event-libevent-dir=/usr --with-php-config=/usr/local/php/bin/php-config && make && make install && cd ../ \
    \
    && runDeps="$( \
            scanelf --needed --nobanner --format '%n#p' --recursive /usr/local \
                | tr ',' '
' \ | sort -u \ | awk 'system("[ -e /usr/local/lib/" $1 " ]") == 0 { next } { print "so:" $1 }' \ )" \ && apk add --no-cache $runDeps \ \ && /usr/local/php/bin/pecl update-channels \ # others of necessary && /usr/local/php/bin/pecl install igbinary swoole event uuid inotify redis \ # memcached && rm -rf /tmp/pear ~/.pearrc WORKDIR /usr/local/php/bin []:~/tmp#

ここでは公式を参照して構築に成功することはできませんが、後で続けます.