Skip to content

Commit

Permalink
php-laravel+nodejs
Browse files Browse the repository at this point in the history
  • Loading branch information
hypchina committed Apr 14, 2020
1 parent 3f43def commit bcc6ce7
Show file tree
Hide file tree
Showing 10 changed files with 5,314 additions and 5 deletions.
67 changes: 62 additions & 5 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ services:
image: nginx:1.14.2
container_name: "my-nginx"
depends_on:
- php
- laravel
volumes:
- /dockershare/data/logs/nginx:/var/log/nginx
- /dockershare/lnmp-config/nginx/nginx.conf:/etc/nginx/nginx.conf
Expand All @@ -15,10 +15,22 @@ services:
- 80:80
networks:
- lnmp
php:
#image: cat2xyj/mini_php
build: ./miniphp
container_name: "my-php"
# php:
# #image: cat2xyj/mini_php
# build: ./miniphp
# container_name: "my-php"
# volumes:
# - /dockershare/lnmp-config/php/php-fpm.conf:/usr/local/etc/php-fpm.conf
# - /dockershare/lnmp-config/php/www.conf:/usr/local/etc/php-fpm.d/www.conf
# - /dockershare/lnmp-config/php/php.ini:/usr/local/etc/php/php.ini
# - /dockershare/app:/data/app
# ports:
# - 9000:9000
# networks:
# - lnmp
laravel:
build: ./laravel
container_name: "my-laravel"
volumes:
- /dockershare/lnmp-config/php/php-fpm.conf:/usr/local/etc/php-fpm.conf
- /dockershare/lnmp-config/php/www.conf:/usr/local/etc/php-fpm.d/www.conf
Expand All @@ -28,6 +40,16 @@ services:
- 9000:9000
networks:
- lnmp
node:
build: ./node
# image: node:latest
container_name: "my-node"
networks:
- lnmp
volumes:
- /dockershare/app/node:/data/app/node
ports:
- "3000:3000"
redis:
build: ./redis
container_name: "my-redis"
Expand All @@ -39,5 +61,40 @@ services:
- /dockershare/lnmp-config/redis/redis.conf:/usr/local/etc/redis/redis.conf
ports:
- "6379:6379"
# tomcate:
# image: "tomcate:latest"
# container_name: "my-tomcat"
# networks:
# - lnmp
# ports:
# - 8080
# splash:
# image: "scrapinghub/splash"
# container_name: "my-splash"
# networks:
# - lnmp
# ports:
# - 8050:8050
mysql_57:
#build: "./mysql57"
image: mysql:5.7
container_name: "my-mysql"
networks:
- lnmp
ports:
- 3306:3306
environment:
MYSQL_ROOT_PASSWORD: "123456"
MYSQL_USER: "docker"
MYSQL_PASSWORD: "123456"
volumes:
#以下代码在win7中会被mysql忽略配置
#- /dockershare/lnmp-config/mysql/my.cnf:/etc/mysql/my.cnf
#- /dockershare/data/storage/mysql57:/var/lib/mysql
#挂载到VM中 但是重启机器会消失,所以最好手动备份数据 到 /dockershare/data/storage/mysql57
#备份 sudo cp -Rp /data/storage/mysql57/* /dockershare/data/storage/mysql57
#还原 sudo mkdir -p /data/storage/mysql57 && sudo cp -Rp /data/storage/mysql57/* /dockershare/data/storage/mysql57
- /mysql/data:/var/lib/mysql
- /dockershare/data/logs/mysql57:/var/log/mysql
networks:
lnmp:
122 changes: 122 additions & 0 deletions laravel/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,122 @@
FROM php:7.3-fpm

COPY swoole-4.4.17.tgz /usr/local/lib/swoole-4.4.17.tgz
COPY xdebug-2.9.4.tgz /usr/local/lib/xdebug-2.9.4.tgz
COPY composer.phar /usr/local/bin/composer
#COPY composer.installer.php /usr/local/lib/composer.installer.php
COPY sources.list /etc/apt/sources.list
# 测试容器 docker run --name testphp -it --rm php:7.3-fpm bash
# 官方版本默认安装扩展:
# 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

RUN apt-get update && apt-get install -y git \
libbz2-dev \
libenchant-dev \
libfreetype6-dev \
libjpeg62-turbo-dev \
libpng-dev \
libgmp-dev \
libxml2-dev \
libtidy-dev \
libxslt1-dev \
libzip-dev \
libsnmp-dev \
libpq-dev \
libpspell-dev \
librecode-dev \
firebird-dev \
freetds-dev \
libldap2-dev \
libicu-dev \
libmcrypt-dev \
libreadline-dev \
libmagickwand-dev \
build-essential \
libmagickcore-dev \
libmagickwand-dev \
&& docker-php-ext-install \
bz2 \
enchant \
gmp \
soap \
wddx \
xmlrpc \
tidy \
xsl \
zip \
snmp \
pgsql \
pdo_pgsql \
pspell \
recode \
pdo_firebird \
interbase \
intl
RUN docker-php-ext-configure gd --with-freetype-dir=/usr/include/ --with-jpeg-dir=/usr/include/ && docker-php-ext-install -j$(nproc) gd
RUN docker-php-ext-configure pdo_dblib --with-libdir=lib/x86_64-linux-gnu && docker-php-ext-install -j$(nproc) pdo_dblib
RUN docker-php-ext-configure ldap --with-libdir=lib/x86_64-linux-gnu && docker-php-ext-install -j$(nproc) ldap
#RUN docker-php-ext-configure imap --with-kerberos --with-imap-ssl && docker-php-ext-install imap

RUN pecl install mcrypt-1.0.3 && docker-php-ext-enable mcrypt
# imagick
RUN export CFLAGS="$PHP_CFLAGS" CPPFLAGS="$PHP_CPPFLAGS" LDFLAGS="$PHP_LDFLAGS" && pecl install imagick-3.4.3 && docker-php-ext-enable imagick


# 1.0.22 redis 扩展
RUN pecl install redis-5.2.1 && docker-php-ext-enable redis
# 1.0.23 增加 swoole 扩展
RUN pecl install /usr/local/lib/swoole-4.4.17.tgz && docker-php-ext-enable swoole
# 1.0.24 增加 opcache 扩展
RUN docker-php-ext-configure opcache --enable-opcache && docker-php-ext-install opcache
# 1.0.25 增加 xdebug 扩展
RUN pecl install /usr/local/lib/xdebug-2.9.4.tgz && docker-php-ext-enable xdebug
# composer
RUN chmod 755 /usr/local/bin/composer && composer config -g repo.packagist composer https://packagist.phpcomposer.com
#RUN curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer \
# && composer config -g repo.packagist composer https://packagist.phpcomposer.com
#RUN php -r "readfile('composer.installer.php');" | php -- --install-dir=/usr/local/bin --filename=composer \
#&& composer config -g repo.packagist composer https://packagist.phpcomposer.com

# 1.0.2 增加 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

# 1.0.26 增加 odbc, pdo_odbc 扩展
RUN set -ex; \
docker-php-source extract; \
{ \
echo '# https://github.com/docker-library/php/issues/103#issuecomment-271413933'; \
echo 'AC_DEFUN([PHP_ALWAYS_SHARED],[])dnl'; \
echo; \
cat /usr/src/php/ext/odbc/config.m4; \
} > temp.m4; \
mv temp.m4 /usr/src/php/ext/odbc/config.m4; \
apt-get update; \
apt-get install -y --no-install-recommends unixodbc-dev; \
rm -rf /var/lib/apt/lists/*; \
docker-php-ext-configure odbc --with-unixODBC=shared,/usr; \
docker-php-ext-configure pdo_odbc --with-pdo-odbc=unixODBC,/usr; \
docker-php-ext-install odbc pdo_odbc; \
docker-php-source delete

# 镜像信息
LABEL Author="Hyp"
LABEL Version="1.0.25-fpm"
LABEL Description="PHP FPM 7.3 镜像. All extensions."


#构建镜像 docker build -t 镜像名称 上下文路径
Loading

0 comments on commit bcc6ce7

Please sign in to comment.