## Docker中配置Laravel PHP环境,非编译,独立镜像
- 同时安装 redis,gd,pdo_mysql拓展和composer
#### 基础PHP镜像 Dockerfile
``` Dockerfile
FROM php:7.3-fpm
RUN pecl install -o -f redis \
&& docker-php-ext-enable redis \
&& apt-get update && apt-get install -y \
libwebp-dev \
libfreetype6-dev \
libjpeg62-turbo-dev \
libpng-dev \
zip \
&& docker-php-ext-configure gd --with-webp-dir=/usr/include/webp --with-freetype-dir=/usr/include/ --with-jpeg-dir=/usr/include/ \
&& docker-php-ext-install -j$(nproc) gd \
&& docker-php-ext-install pdo_mysql \
&& cd /root && php -r "copy('https://install.phpcomposer.com/installer', 'composer-setup.php');" \
&& php composer-setup.php \
&& mv composer.phar /usr/local/bin/composer \
&& composer config -g repo.packagist composer https://mirrors.aliyun.com/composer/ \
&& composer selfupdate
```
#### use dockerfile 使用
``` Base
# 创建 image
docker build -t adddge/php:7.3-fpm ./
```
- [https://hub.docker.com/r/adddge/php](https://hub.docker.com/r/adddge/php)
#### Laravel环境镜像
``` Dockerfile
FROM adddge/php:7.3-fpm
# FROM adphp-fpm:7.3
RUN composer global require laravel/installer \
&& echo "export PATH=$PATH:/root/.composer/vendor/bin" >> /etc/bash.bashrc
EXPOSE 9000 8000
# docker build -t adddge/laravel:2021 ./
```
- [https://hub.docker.com/r/adddge/laravel](https://hub.docker.com/r/adddge/laravel)