From aa3ff5cb663e9400a3952adee120370293eaffee Mon Sep 17 00:00:00 2001 From: Linus Xiong Date: Sun, 8 Dec 2024 01:48:49 -0500 Subject: [PATCH] fix bug --- .env.example | 69 +++++++++++++++++++++++++++------------------------- Dockerfile | 24 +++++++----------- 2 files changed, 45 insertions(+), 48 deletions(-) diff --git a/.env.example b/.env.example index 6211636..93f2d35 100644 --- a/.env.example +++ b/.env.example @@ -1,40 +1,43 @@ -APP_NAME=${APP_NAME:-XBoard} -APP_ENV=${APP_ENV:-local} -APP_KEY=${APP_KEY:-base64:PZXk5vTuTinfeEVG5FpYv2l6WEhLsyvGpiWK7IgJJ60=} -APP_DEBUG=${APP_DEBUG:-false} -APP_URL=${APP_URL:-http://localhost} -ADMIN_SETTING_CACHE=${ADMIN_SETTING_CACHE:-60} -LOG_CHANNEL=${LOG_CHANNEL:-stack} +APP_NAME=XBoard +APP_ENV=local +APP_KEY=base64:PZXk5vTuTinfeEVG5FpYv2l6WEhLsyvGpiWK7IgJJ60= +APP_DEBUG=false +APP_URL=http://localhost -DB_CONNECTION=${DB_CONNECTION:-mysql} -DB_HOST=${DB_HOST:-127.0.0.1} -DB_PORT=${DB_PORT:-3306} -DB_DATABASE=${DB_DATABASE:-xboard} -DB_USERNAME=${DB_USERNAME:-root} -DB_PASSWORD=${DB_PASSWORD:-} +ADMIN_SETTING_CACHE=60 #设置缓存时间(单位秒) +LOG_CHANNEL=stack -REDIS_HOST=${REDIS_HOST:-127.0.0.1} -REDIS_PASSWORD=${REDIS_PASSWORD:-null} -REDIS_PORT=${REDIS_PORT:-6379} +DB_CONNECTION=mysql +DB_HOST=127.0.0.1 +DB_PORT=3306 +DB_DATABASE=xboard +DB_USERNAME=root +DB_PASSWORD= -BROADCAST_DRIVER=${BROADCAST_DRIVER:-log} -CACHE_DRIVER=${CACHE_DRIVER:-redis} -QUEUE_CONNECTION=${QUEUE_CONNECTION:-redis} +REDIS_HOST=127.0.0.1 +REDIS_PASSWORD=null +REDIS_PORT=6379 -MAIL_DRIVER=${MAIL_DRIVER:-smtp} -MAIL_HOST=${MAIL_HOST:-smtp.mailtrap.io} -MAIL_PORT=${MAIL_PORT:-2525} -MAIL_USERNAME=${MAIL_USERNAME:-null} -MAIL_PASSWORD=${MAIL_PASSWORD:-null} -MAIL_ENCRYPTION=${MAIL_ENCRYPTION:-null} -MAIL_FROM_ADDRESS=${MAIL_FROM_ADDRESS:-null} -MAIL_FROM_NAME=${MAIL_FROM_NAME:-null} +#默认将队列驱动和缓存驱动都修改为了redis,请务必安装redis +BROADCAST_DRIVER=log +CACHE_DRIVER=redis +QUEUE_CONNECTION=redis -MAILGUN_DOMAIN=${MAILGUN_DOMAIN:-} -MAILGUN_SECRET=${MAILGUN_SECRET:-} +MAIL_DRIVER=smtp +MAIL_HOST=smtp.mailtrap.io +MAIL_PORT=2525 +MAIL_USERNAME=null +MAIL_PASSWORD=null +MAIL_ENCRYPTION=null +MAIL_FROM_ADDRESS=null +MAIL_FROM_NAME=null +MAILGUN_DOMAIN= +MAILGUN_SECRET= -ENABLE_AUTO_BACKUP_AND_UPDATE=${ENABLE_AUTO_BACKUP_AND_UPDATE:-false} -GOOGLE_CLOUD_KEY_FILE=${GOOGLE_CLOUD_KEY_FILE:-config/googleCloudStorageKey.json} -GOOGLE_CLOUD_STORAGE_BUCKET=${GOOGLE_CLOUD_STORAGE_BUCKET:-} +# google cloud stoage +ENABLE_AUTO_BACKUP_AND_UPDATE=false +GOOGLE_CLOUD_KEY_FILE=config/googleCloudStorageKey.json +GOOGLE_CLOUD_STORAGE_BUCKET= -INSTALLED=${INSTALLED:-false} +# 用于阻止重复安装 +INSTALLED=false diff --git a/Dockerfile b/Dockerfile index ea86f2b..f0102c0 100644 --- a/Dockerfile +++ b/Dockerfile @@ -2,23 +2,17 @@ FROM phpswoole/swoole:php8.1-alpine COPY --from=mlocati/php-extension-installer /usr/bin/install-php-extensions /usr/local/bin/ -RUN install-php-extensions pcntl bcmath inotify \ - && apk --no-cache add shadow supervisor nginx sqlite nginx-mod-http-brotli mysql-client git patch \ - && addgroup -S -g 1000 www && adduser -S -G www -u 1000 www - -# 设置工作目录 +RUN install-php-extensions pcntl bcmath inotify \ +&& apk --no-cache add shadow supervisor nginx sqlite nginx-mod-http-brotli mysql-client git patch \ +&& addgroup -S -g 1000 www && adduser -S -G www -u 1000 www +#复制项目文件以及配置文件 WORKDIR /www - -# 复制项目文件和配置文件 COPY .docker / COPY . /www +RUN composer install --optimize-autoloader --no-cache --no-dev \ +&& php artisan storage:link \ +&& cp /www/.env.example /www/.env \ +&& chown -R www:www /www \ +&& chmod -R 775 /www -# 生成环境变量文件并安装依赖 -RUN cp /www/.env.example /www/.env \ - && composer install --optimize-autoloader --no-cache --no-dev \ - && php artisan storage:link \ - && chown -R www:www /www \ - && chmod -R 775 /www - -# 启动 supervisor CMD ["/usr/bin/supervisord", "--nodaemon", "-c", "/etc/supervisor/supervisord.conf"]