2023-11-17 01:44:01 -05:00
|
|
|
FROM phpswoole/swoole:php8.1-alpine
|
|
|
|
|
|
|
|
COPY --from=mlocati/php-extension-installer /usr/bin/install-php-extensions /usr/local/bin/
|
|
|
|
|
2024-12-08 00:53:43 -05:00
|
|
|
RUN install-php-extensions pcntl bcmath inotify \
|
2024-12-08 01:38:27 -05:00
|
|
|
&& apk --no-cache add shadow supervisor nginx sqlite nginx-mod-http-brotli mysql-client git patch \
|
2024-12-08 00:53:43 -05:00
|
|
|
&& addgroup -S -g 1000 www && adduser -S -G www -u 1000 www
|
|
|
|
|
|
|
|
# 设置工作目录
|
2023-11-17 01:44:01 -05:00
|
|
|
WORKDIR /www
|
2024-12-08 00:53:43 -05:00
|
|
|
|
|
|
|
# 复制项目文件和配置文件
|
2023-11-17 01:44:01 -05:00
|
|
|
COPY .docker /
|
|
|
|
COPY . /www
|
2024-12-08 00:53:43 -05:00
|
|
|
|
|
|
|
# 生成环境变量文件并安装依赖
|
2024-12-08 01:38:27 -05:00
|
|
|
RUN cp /www/.env.example /www/.env \
|
2024-12-08 00:53:43 -05:00
|
|
|
&& composer install --optimize-autoloader --no-cache --no-dev \
|
|
|
|
&& php artisan storage:link \
|
|
|
|
&& chown -R www:www /www \
|
|
|
|
&& chmod -R 775 /www
|
2023-11-17 01:44:01 -05:00
|
|
|
|
2024-12-08 00:53:43 -05:00
|
|
|
# 启动 supervisor
|
2024-12-08 01:38:27 -05:00
|
|
|
CMD ["/usr/bin/supervisord", "--nodaemon", "-c", "/etc/supervisor/supervisord.conf"]
|