From d385b9ba6c5eb8a0a25b203577c387fb35c7cd11 Mon Sep 17 00:00:00 2001 From: tradewind Date: Fri, 4 Jun 2021 18:01:18 +0800 Subject: [PATCH] #tradewind:init --- .gitignore | 2 + docker-compose.yml | 47 +++++++++++++ mysql/dockerfile | 2 + mysql/sources.list | 10 +++ php7.4/dockerfile | 39 +++++++++++ php7.4/php-ext.sh | 156 ++++++++++++++++++++++++++++++++++++++++++++ php7.4/sources.list | 10 +++ redis/dockerfile | 5 ++ 8 files changed, 271 insertions(+) create mode 100644 .gitignore create mode 100644 docker-compose.yml create mode 100644 mysql/dockerfile create mode 100644 mysql/sources.list create mode 100644 php7.4/dockerfile create mode 100644 php7.4/php-ext.sh create mode 100644 php7.4/sources.list create mode 100644 redis/dockerfile diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..29b636a --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +.idea +*.iml \ No newline at end of file diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..dbe972a --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,47 @@ +version: "3" + +services: + php7.4: + build: + context: ./php7.4/ + dockerfile: dockerfile + volumes: + - ./php7.4/sources.list:/etc/apt/sources.list + - /var/www/http:/var/www/http + networks: + - server + container_name: php7.4 + ports: + - 9000:9000 + restart: always + mysql: # 添加 mysql 服务 + build: + context: mysql/ + dockerfile: dockerfile + restart: always + environment: + MYSQL_ROOT_PASSWORD: root + # command: --character-set-server=utf8mb4 --collation-server=utf8mb4_unicode_ci # 设置编码 + # command: mysqld --character-set-server=utf8mb4 --collation-server=utf8mb4_unicode_ci #设置utf8字符集 + command: --default-authentication-plugin=mysql_native_password +# volumes: +# - ${MYSQL_DATA_PATH}:/var/lib/mysql + networks: + - server + ports: + - 3306:3306 + container_name: mysql + redis: + build: + context: ./redis/ + dockerfile: dockerfile + restart: always + networks: + - server +# volumes: +# - ${REDIS_DATA_PATH}:/data + ports: + - 6379:6379 + container_name: redis +networks: + server: \ No newline at end of file diff --git a/mysql/dockerfile b/mysql/dockerfile new file mode 100644 index 0000000..b2279c6 --- /dev/null +++ b/mysql/dockerfile @@ -0,0 +1,2 @@ +FROM mysql:5.7 +MAINTAINER tradewind diff --git a/mysql/sources.list b/mysql/sources.list new file mode 100644 index 0000000..8fbb4a9 --- /dev/null +++ b/mysql/sources.list @@ -0,0 +1,10 @@ +deb http://mirrors.aliyun.com/ubuntu/ bionic main restricted universe multiverse +deb http://mirrors.aliyun.com/ubuntu/ bionic-security main restricted universe multiverse +deb http://mirrors.aliyun.com/ubuntu/ bionic-updates main restricted universe multiverse +deb http://mirrors.aliyun.com/ubuntu/ bionic-proposed main restricted universe multiverse +deb http://mirrors.aliyun.com/ubuntu/ bionic-backports main restricted universe multiverse +deb-src http://mirrors.aliyun.com/ubuntu/ bionic main restricted universe multiverse +deb-src http://mirrors.aliyun.com/ubuntu/ bionic-security main restricted universe multiverse +deb-src http://mirrors.aliyun.com/ubuntu/ bionic-updates main restricted universe multiverse +deb-src http://mirrors.aliyun.com/ubuntu/ bionic-proposed main restricted universe multiverse +deb-src http://mirrors.aliyun.com/ubuntu/ bionic-backports main restricted universe multiverse \ No newline at end of file diff --git a/php7.4/dockerfile b/php7.4/dockerfile new file mode 100644 index 0000000..28d6bac --- /dev/null +++ b/php7.4/dockerfile @@ -0,0 +1,39 @@ +FROM php:7.4-fpm-alpine + +MAINTAINER tradewind + +RUN sed -i 's/dl-cdn.alpinelinux.org/mirrors.aliyun.com/g' /etc/apk/repositories + +RUN apk add --no-cache --virtual .build-deps \ + $PHPIZE_DEPS \ + curl-dev \ + imagemagick-dev \ + libtool \ + libxml2-dev \ + postgresql-dev \ + sqlite-dev \ + && apk add --no-cache \ + curl \ + git \ + imagemagick \ + mysql-client \ + postgresql-libs \ + openssl \ + && pecl install imagick \ + && docker-php-ext-enable imagick \ + && pecl install xdebug-2.6.1 \ + && docker-php-ext-enable xdebug \ + && docker-php-ext-install \ + curl \ + iconv \ + mbstring \ + pdo \ + pdo_mysql \ + pdo_pgsql \ + pdo_sqlite \ + pcntl \ + tokenizer \ + xml \ + zip \ + && curl -s https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin/ --filename=composer \ + && apk del -f .build-deps \ No newline at end of file diff --git a/php7.4/php-ext.sh b/php7.4/php-ext.sh new file mode 100644 index 0000000..b0458e8 --- /dev/null +++ b/php7.4/php-ext.sh @@ -0,0 +1,156 @@ +#!/bin/sh + +sed -i "s/dl-cdn.alpinelinux.org/mirrors.aliyun.com/g" /etc/apk/repositories + +apk add --no-cache autoconf g++ libtool make curl-dev libxml2-dev linux-headers + +#echo "---------- Install mcrypt ----------" +#apk add --no-cache libmcrypt-dev +#docker-php-ext-install mcrypt + +echo "---------- Install pdo_mysql ----------" +docker-php-ext-install -j 2 pdo_mysql + +echo "---------- Install zip ----------" +docker-php-ext-install -j 2 zip + +echo "---------- Install pcntl ----------" +docker-php-ext-install -j 2 pcntl + + +echo "---------- Install mysqli ----------" +docker-php-ext-install -j 2 mysqli + + +echo "---------- Install mbstring ----------" +docker-php-ext-install -j 2 mbstring + +echo "---------- Install exif ----------" +docker-php-ext-install -j 2 exif + +echo "---------- Install calendar ----------" +docker-php-ext-install -j 2 calendar + +echo "---------- Install sockets ----------" +docker-php-ext-install -j 2 sockets + +echo "---------- Install gettext ----------" +apk add --no-cache gettext-dev +docker-php-ext-install -j 2 gettext + +echo "---------- Install shmop ----------" +docker-php-ext-install -j 2 shmop + +echo "---------- Install bz2 ----------" +apk add --no-cache bzip2-dev +docker-php-ext-install -j 2 bz2 + +echo "---------- Install xsl ----------" +apk add --no-cache libxslt-dev +docker-php-ext-install -j 2 xsl + +echo "---------- Install wddx ----------" +apk add --no-cache libxslt-dev +docker-php-ext-install -j 2 wddx + +echo "---------- Install curl ----------" +docker-php-ext-install -j 2 curl + +echo "---------- Install mysql ----------" +docker-php-ext-install -j 2 mysql + +echo "---------- Install wddx ----------" +docker-php-ext-install -j 2 wddx + +echo "---------- Install readline ----------" +apk add --no-cache readline-dev +apk add --no-cache libedit-dev +docker-php-ext-install -j 2 readline + +echo "---------- Install gmp ----------" +apk add --no-cache gmp-dev +docker-php-ext-install -j 2 gmp + +echo "---------- Install ldap ----------" +apk add --no-cache ldb-dev +apk add --no-cache openldap-dev +docker-php-ext-install -j 2 ldap + +echo "---------- Install redis ----------" +curl -L -o /tmp/redis.tar.gz https://github.com/phpredis/phpredis/archive/4.0.1.tar.gz \ +&& tar xfz /tmp/redis.tar.gz -C /usr/src/php/ext/ \ +&& mv /usr/src/php/ext/phpredis-4.0.1 /usr/src/php/ext/redis \ +&& rm -r /tmp/redis.tar.gz \ +&& docker-php-ext-install redis + +echo "---------- Install gd ----------" +docker-php-ext-install gd + + +echo "---------- Install bcmath ----------" +docker-php-ext-install bcmath + + +echo "---------- Install ctype ----------" +docker-php-ext-install ctype + + +echo "---------- Install fileinfo ----------" +docker-php-ext-install fileinfo + + +echo "---------- Install mbstring ----------" +docker-php-ext-install mbstring + + +echo "---------- Install openssl ----------" +docker-php-ext-install openssl + + +echo "---------- Install pdo ----------" +docker-php-ext-install pdo + + +echo "---------- Install tokenizer ----------" +docker-php-ext-install tokenizer + + +echo "---------- Install XML ----------" +docker-php-ext-install xml + + +echo "---------- Install xdebug ----------" +wget http://xdebug.org/files/xdebug-2.9.8.tgz -O /usr/src/php/ext/xdebug.tgz \ +&& tar -xzvf /usr/src/php/ext/xdebug.tgz -C /usr/src/php/ext/ && rm /usr/src/php/ext/package.xml && rm /usr/src/php/ext/xdebug.tgz \ +&& mv /usr/src/php/ext/xdebug-2.9.8 /usr/src/php/ext/xdebug \ +&& docker-php-ext-install xdebug + + +echo "---------- Install soap ----------" +apk add --no-cache php-soap +docker-php-ext-install soap + +echo "---------- Install pcre ----------" +docker-php-ext-install pcre + +echo "---------- Install opcache ----------" +docker-php-ext-install opcache + + +echo "---------- Install intl ----------" +#apk add icu-dev apt-get install libicu-dev +apk add icu-dev \ +&& docker-php-ext-install intl +#apk add --no-cache freetype-dev libjpeg-turbo-dev libpng-dev \ +#&& docker-php-ext-configure gd --with-freetype-dir=/usr/include/ --with-jpeg-dir=/usr/include/ \ +#&& docker-php-ext-install -j 2 gd +#apk add libpng-dev freetype-dev libjpeg-turbo-dev \ +# && docker-php-ext-configure gd --with-freetype-dir=/usr/include/ --with-jpeg-dir=/usr/include/ --with-png-dir=/usr/include/ \ +# && docker-php-ext-install -j$(nproc) gd +#echo "---------- Install mhash ----------" +#mkdir mhash \ +#&& tar -xf mhash-0.9.9.9.tar.gz -C mhash --strip-components=1 \ +#&& ( cd mhash && ./configure && make && make install )\ +#&& docker-php-source extract \ +#&& ( cd /usr/src/php && ./configure --with-mcrypt --with-mhash=/usr/local/include && make && make install ) +# && docker-php-source delete \ No newline at end of file diff --git a/php7.4/sources.list b/php7.4/sources.list new file mode 100644 index 0000000..8fbb4a9 --- /dev/null +++ b/php7.4/sources.list @@ -0,0 +1,10 @@ +deb http://mirrors.aliyun.com/ubuntu/ bionic main restricted universe multiverse +deb http://mirrors.aliyun.com/ubuntu/ bionic-security main restricted universe multiverse +deb http://mirrors.aliyun.com/ubuntu/ bionic-updates main restricted universe multiverse +deb http://mirrors.aliyun.com/ubuntu/ bionic-proposed main restricted universe multiverse +deb http://mirrors.aliyun.com/ubuntu/ bionic-backports main restricted universe multiverse +deb-src http://mirrors.aliyun.com/ubuntu/ bionic main restricted universe multiverse +deb-src http://mirrors.aliyun.com/ubuntu/ bionic-security main restricted universe multiverse +deb-src http://mirrors.aliyun.com/ubuntu/ bionic-updates main restricted universe multiverse +deb-src http://mirrors.aliyun.com/ubuntu/ bionic-proposed main restricted universe multiverse +deb-src http://mirrors.aliyun.com/ubuntu/ bionic-backports main restricted universe multiverse \ No newline at end of file diff --git a/redis/dockerfile b/redis/dockerfile new file mode 100644 index 0000000..4120375 --- /dev/null +++ b/redis/dockerfile @@ -0,0 +1,5 @@ +FROM redis:6.2-alpine +MAINTAINER tradewind +RUN sed -i \ + 's/dl-cdn.alpinelinux.org/mirrors.tuna.tsinghua.edu.cn/g' \ + /etc/apk/repositories && apk update \ No newline at end of file