Dockerfile 参考
FROM php:7.4-fpm-alpine
#docker build -t apnode:php-fpm-7.4 .
#ADD ./test.jar /opt/App/test.jar
#拷贝字体文件
#COPY ./simhei.ttf /usr/share/fonts/simhei.ttf
#设置字符集
ENV LANG en_US.UTF-8
# RUN apk --update add font-config ttf-dejavu
# RUN rum -rf /var/cache/apk/*
# 设置镜像
RUN sed -i '3s/#//' /etc/apk/repositories && sed -i 's/dl-cdn.alpinelinux.org/mirrors.aliyun.com/g' /etc/apk/repositories
# 设置时区
RUN apk --update --no-cache add tzdata && cp /usr/share/zoneinfo/Asia/Shanghai /etc/localtime && echo "Asia/Shanghai" > /etc/timezone
# 安装 中文字体 CURL
RUN apk --update --no-cache add ttf-dejavu fontconfig curl ca-certificates
# 安装 图片库
RUN apk --update --no-cache add libpng libpng-dev libwebp libwebp-dev freetype freetype-dev libjpeg libjpeg-turbo libzip libzip-dev libjpeg-turbo-dev zlib sqlite sqlite-dev postgresql-dev icu-data-full
# 安装 编译工具
RUN apk --update --no-cache add gcc g++ make cmake automake autoconf
# 安装 PHP-GD,MySQL, pgsql,sqlite
#RUN docker-php-ext-configure gd --with-webp=/usr/include/webp --with-jpeg=/usr/include --with-freetype=/usr/include/freetype2 && docker-php-ext-install pcntl zip gd mysqli pdo pdo_mysql pdo_sqlite pdo_pgsql
#RUN docker-php-ext-configure gd --with-freetype-dir=/usr/include/ --with-jpeg-dir=/usr/include/ --with-png-dir=/usr/include/ --with-gd
RUN docker-php-ext-configure gd --with-webp=/usr/include/webp --with-jpeg=/usr/include --with-freetype=/usr/include/freetype2 && docker-php-ext-install pcntl zip gd mysqli pdo pdo_mysql pdo_sqlite pdo_pgsql
# 安装 PHP-Redis
# RUN docker-php-source extract && pecl install redis && echo extension=redis.so >/usr/local/etc/php/conf.d/pecl-redis.ini && docker-php-source delete
RUN docker-php-source extract && pecl install redis && docker-php-ext-enable redis && docker-php-source delete
使用的方式
docker run --rm -it -v $(pwd):/app -w /app -p 8000:8000 apnode/fpm sh
docker run --name fpm -itd -v /app:/app -p 9000:9000 apnode/fpm
docker run --name crmeb -itd -v /app:/app -w /app -p 8000:8000 apnode/fpm php /app/www/CRMEB/crmeb/think run
docker run --name crmeb -itd -v $(pwd):/app -w /app -p 8001:8000 apnode/fpm php /app/think run
docker run --name worker -itd -v $(pwd):/app -w /app -p 50001:50001 -p 50002:50002 apnode/fpm php /app/think workerman start