feature: supervisor add include for custome conf

This commit is contained in:
kriss 2023-02-23 13:11:15 +08:00
parent 7018085155
commit 9acd2148fd
4 changed files with 23 additions and 20 deletions

1
.gitignore vendored
View File

@ -2,3 +2,4 @@
/.vscode /.vscode
/composer.lock /composer.lock
/vendor /vendor
/.env

View File

@ -1,18 +1,24 @@
ARG PHP_CLI_VERSION=7.4.29-cli-alpine
ARG PHP_EXTENSION_INSTALL_VERSION=1.5.17
ARG COMPOSER_VERSION=2.3.5
FROM mlocati/php-extension-installer:$PHP_EXTENSION_INSTALL_VERSION AS php-extension-installer
# https://hub.docker.com/_/php # https://hub.docker.com/_/php
FROM php:$PHP_CLI_VERSION ARG PHP_CLI_VERSION=7.4-cli-alpine
# https://hub.docker.com/r/mlocati/php-extension-installer
ARG PHP_EXTENSION_INSTALL_VERSION=latest
# https://hub.docker.com/r/composer/composer
ARG COMPOSER_VERSION=latest
# 开始构建
FROM php:$PHP_CLI_VERSION AS build
# install-php-extensions
FROM mlocati/php-extension-installer:$PHP_EXTENSION_INSTALL_VERSION AS php-extension-installer
# composer
FROM composer/composer:$COMPOSER_VERSION AS composer
# 系统依赖安装 # 系统依赖安装
COPY --from=php-extension-installer /usr/bin/install-php-extensions /usr/local/bin/
COPY --from=composer /usr/bin/composer /usr/bin/composer
RUN apk add --no-cache supervisor unzip RUN apk add --no-cache supervisor unzip
# PHP 扩展安装 # PHP 扩展安装
# install-php-extensions https://github.com/mlocati/docker-php-extension-installer
COPY --from=php-extension-installer /usr/bin/install-php-extensions /usr/local/bin/
# https://github.com/mlocati/docker-php-extension-installer#supported-php-extensions # https://github.com/mlocati/docker-php-extension-installer#supported-php-extensions
RUN install-php-extensions \ RUN install-php-extensions \
bcmath \ bcmath \
@ -24,21 +30,14 @@ RUN install-php-extensions \
pcntl \ pcntl \
redis \ redis \
sockets \ sockets \
zip \ zip
@composer-$COMPOSER_VERSION
# 展示各组件
RUN php -v
RUN php -m
RUN composer
RUN install-php-extensions
# 设置配置文件 # 设置配置文件
# php # php
RUN mv "$PHP_INI_DIR/php.ini-production" "$PHP_INI_DIR/php.ini" RUN mv "$PHP_INI_DIR/php.ini-production" "$PHP_INI_DIR/php.ini"
COPY config/php.ini "$PHP_INI_DIR/conf.d/app.ini" COPY config/php.ini "$PHP_INI_DIR/conf.d/app.ini"
# supervisor # supervisor
COPY config/supervisord.conf /etc/supervisor/conf.d/supervisord.conf COPY config/supervisord.conf /etc/supervisor/supervisord.conf
# 设置项目目录 # 设置项目目录
RUN mkdir -p /app RUN mkdir -p /app
@ -48,4 +47,4 @@ WORKDIR /app
EXPOSE 8787 EXPOSE 8787
# 启动脚本 # 启动脚本
CMD ["/usr/bin/supervisord", "-c", "/etc/supervisor/conf.d/supervisord.conf"] CMD ["/usr/bin/supervisord", "-c", "/etc/supervisor/supervisord.conf"]

View File

@ -106,7 +106,7 @@ FROM krisss/docker-webman:$WEBMAN_DOCKER_VERSION
#COPY environments/docker/my_php.ini "$PHP_INI_DIR/conf.d/my_php.ini" #COPY environments/docker/my_php.ini "$PHP_INI_DIR/conf.d/my_php.ini"
# 自定义 supervisor 配置,如果需要的话 # 自定义 supervisor 配置,如果需要的话
# 覆盖镜像自带的 # 覆盖镜像自带的
#COPY environments/docker/supervisord.conf /etc/supervisor/conf.d/supervisord.conf #COPY environments/docker/supervisord.conf /etc/supervisor/supervisord.conf
# 扩展额外的 # 扩展额外的
#COPY environments/docker/my_supervisord.conf /etc/supervisor/conf.d/my_supervisord.conf #COPY environments/docker/my_supervisord.conf /etc/supervisor/conf.d/my_supervisord.conf

View File

@ -12,3 +12,6 @@ stderr_logfile=/dev/stderr
stderr_logfile_maxbytes=0 stderr_logfile_maxbytes=0
autorestart=true autorestart=true
startretries=10 startretries=10
[include]
files = /etc/supervisor/conf.d/*.conf