首页 > 编程语言 >Docker构建PHP8.

Docker构建PHP8.

时间:2022-10-25 17:22:09浏览次数:60  
标签:fpm etc 构建 usr && PHP8 Docker php local

容器Dockerfile

FROM php:8.1-fpm-alpine3.16

RUN echo https://mirrors.ustc.edu.cn/alpine/v3.16/main > /etc/apk/repositories && \
echo https://mirrors.ustc.edu.cn/alpine/v3.16/community >> /etc/apk/repositories

# latest certs
RUN apk add ca-certificates --no-cache && update-ca-certificates
ENV TZ="Asia/Shanghai"
RUN apk add --update tzdata --no-cache  && \
    cp /usr/share/zoneinfo/${TZ} /etc/localtime && \
    echo $TZ > /etc/timezone && apk del tzdata

RUN apk update && apk upgrade

RUN apk add m4 autoconf make gcc g++ linux-headers wget zlib-dev git libxml2 libxml2-dev oniguruma oniguruma-dev && \
    apk add bash strace su-exec
RUN apk add --update curl curl-dev libzip-dev openssl
RUN apk add libpng libpng-dev libjpeg-turbo-dev libwebp-dev libxpm-dev gd vim freetype freetype-dev && \
    apk add libsodium musl libsodium-dev 
RUN docker-php-ext-install opcache zip bcmath pdo_mysql mysqli mbstring xml soap curl gd

# install composer
RUN wget https://mirrors.aliyun.com/composer/composer.phar && mv composer.phar /usr/local/bin/composer && \
    chmod +x /usr/local/bin/composer && \
    composer config -g repo.packagist composer https://mirrors.aliyun.com/composer/


RUN docker-php-ext-enable sodium
RUN docker-php-ext-install pcntl sockets xlswriter  redis

COPY php.ini /usr/local/etc/php/php.ini
COPY php-fpm.conf /usr/local/etc/php-fpm.conf
COPY php-fpm.d/www.conf /usr/local/etc/php-fpm.d/www.conf

RUN sed -i "s/;clear_env = no/clear_env = no/p" /usr/local/etc/php-fpm.d/www.conf &&\
    sed -i "s/daemonize = yes/daemonize = no/p" /usr/local/etc/php-fpm.conf &&\
	sed -i 's/listen = 127.0.0.1:9000/listen = [::]:9000/p' /usr/local/etc/php-fpm.d/www.conf &&\
	sed -i '/listen.allowed_clients = 127.0.0.1/d' /usr/local/etc/php-fpm.d/www.conf &&\
	sed -i 's/error_log = \/var\/log\/php-fpm\/error.log/error_log = \/www\/logs\/php-fpm\/error.log/p' /usr/local/etc/php-fpm.conf


COPY docker-entrypoint.sh /usr/local/bin/
EXPOSE 9000
RUN ["chmod", "+x", "/usr/local/bin/docker-entrypoint.sh"]
CMD ["/bin/sh", "/usr/local/bin/docker-entrypoint.sh"]

容器启动脚本

docker-entrypoint.sh

#!/bin/bash

echo "info: starting php-fpm.."
php-fpm -c /usr/local/etc/php/php.ini -y /usr/local/etc/php-fpm.conf

标签:fpm,etc,构建,usr,&&,PHP8,Docker,php,local
From: https://www.cnblogs.com/nilyang/p/16825571.html

相关文章

  • Centos环境下docker 安装 (一)
    1.安装之前先排查下是否有残留的docker安装包,如果有先删除。$ sudo yumremove docker\         docker-client\         d......
  • Docker-compose
    Docker-Compose是Docker官方的开源项目,负责实现对Docker容器集群的快速编排。Compose是Docker公司推出的一个工具软件,可以管理多个Docker容器组成一个应用。你需要......
  • Caddy File Server Docker部署
    CaddyFileServerDocker部署1.切换到应用的文件夹下面$cd/alidata1/admin/app/caddy2.编辑docker-compose.ymlversion:"3.7"services:caddy:image:......
  • Windows 2016 安装 Docker
    打开PowerShellWindowsPowerShell版权所有(C)2016MicrosoftCorporation。保留所有权利。PSC:\Users\Administrator>[Net.ServicePointManager]::SecurityProt......
  • dockerdile创建镜像
    在执行命令dockerbuild-t='jkd1.8'.报错,可以看到是在配置文件的RUNmkdir处遇到没有这个文件或目录因为这个配置文件没有自动创建我们跑的这个目录,在mkdir后面加上-p(-......
  • 脚本将 Java 包打为 docker 镜像并重启
    DockerfileFROMopenjdk:11.0.16-jreADDbp.jarbp.jarEXPOSE9090ENTRYPOINT["java","-jar","-Dspring.profiles.active=cq","-Duser.timezone=Asia/Shanghai","......
  • Docker之介绍与安装
    Docker说明本章,我们主要从Docker简介、Docker中几个核心概念和Docker安装这几个方面对Docker进行介绍!1、......
  • phpstorm docker容器内配置断点调试xdebug
    以下为php.ini配置[XDebug]xdebug.mode=debug,tracexdebug.start_with_request=yesxdebug.remote_handler="dbgp"xdebug.idekey="PHPSTORM"xdebug.log="/......
  • 构建 Flutter 应用程序的10个最佳 VSCode 插件
    构建Flutter应用程序的10个最佳VSCode插件在本文中,我们将分享使用VisualStudio代码(VSCode)IDE的经验。我们的开发团队更喜欢使用某些插件,这里我们将解释原因......
  • 解决容器Docker内部启动计划任务crontab不生效不执行的问题
    docker使用centos7镜像首先编辑crond,注释#session  required  pam_loginuid.so:vi/etc/pam.d/crond  然后重启crond服务:/etc/init.d/crondrestart ......