app,nginx 合併 20250610
This commit is contained in:
parent
225725a627
commit
088c9183f2
10
.env.example
10
.env.example
@ -1,15 +1,13 @@
|
|||||||
# Project
|
# Project
|
||||||
APP_NAME=ktvcentral
|
APP_NAME=ktvcentral
|
||||||
APP_DOMAIN=zqd.superstar.dnsnet.cc
|
APP_DOMAIN=zqd.superstar.dnsnet.cc
|
||||||
APP_PORT=80
|
APP_PORT=8080
|
||||||
APP_URL=http://zqd.superstar.dnsnet.cc/
|
APP_URL=http://${APP_DOMAIN}:${APP_PORT}
|
||||||
|
|
||||||
REPO_URL="http://47.251.18.130:3000/Leecheng/KTVCentral.git"
|
REPO_URL=http://47.251.18.130:3000/Leecheng/KTVCentral.git
|
||||||
REPO_BRANCH="main"
|
REPO_BRANCH=main
|
||||||
|
|
||||||
# Database
|
# Database
|
||||||
DB_HOST=mariadb
|
|
||||||
DB_PORT=3306
|
|
||||||
DB_DATABASE=KaraokeKingpin
|
DB_DATABASE=KaraokeKingpin
|
||||||
DB_USERNAME=KaraokeKingpin
|
DB_USERNAME=KaraokeKingpin
|
||||||
DB_PASSWORD=ESM7yTPMnavFmbBH
|
DB_PASSWORD=ESM7yTPMnavFmbBH
|
||||||
|
@ -2,6 +2,7 @@ FROM php:8.3-fpm
|
|||||||
|
|
||||||
# ---- system & PHP extensions -------------------------------------------------
|
# ---- system & PHP extensions -------------------------------------------------
|
||||||
RUN apt-get update && apt-get install -y \
|
RUN apt-get update && apt-get install -y \
|
||||||
|
nginx \
|
||||||
git unzip zip curl ca-certificates supervisor cron nano \
|
git unzip zip curl ca-certificates supervisor cron nano \
|
||||||
libpng-dev libjpeg62-turbo-dev libfreetype6-dev \
|
libpng-dev libjpeg62-turbo-dev libfreetype6-dev \
|
||||||
libonig-dev libxml2-dev libzip-dev libpq-dev libicu-dev libxslt-dev \
|
libonig-dev libxml2-dev libzip-dev libpq-dev libicu-dev libxslt-dev \
|
||||||
@ -24,9 +25,9 @@ COPY docker/php/opcache.ini /usr/local/etc/php/conf.d/opcache.ini
|
|||||||
COPY docker/supervisord.conf /etc/supervisor/conf.d/supervisord.conf
|
COPY docker/supervisord.conf /etc/supervisor/conf.d/supervisord.conf
|
||||||
COPY docker/entrypoint.sh /entrypoint.sh
|
COPY docker/entrypoint.sh /entrypoint.sh
|
||||||
COPY docker/entrypoint.git.sh /entrypoint.git.sh
|
COPY docker/entrypoint.git.sh /entrypoint.git.sh
|
||||||
|
COPY docker/nginx/default.conf.template /etc/nginx/conf.d/default.conf
|
||||||
|
|
||||||
WORKDIR /var/www
|
WORKDIR /var/www
|
||||||
|
|
||||||
RUN chmod +x /entrypoint.sh /entrypoint.git.sh
|
RUN chmod +x /entrypoint.sh /entrypoint.git.sh
|
||||||
ENTRYPOINT ["/entrypoint.sh"]
|
ENTRYPOINT ["/entrypoint.sh"]
|
||||||
CMD ["docker-php-entrypoint", "php-fpm"]
|
|
@ -26,6 +26,11 @@ services:
|
|||||||
volumes:
|
volumes:
|
||||||
- ./data/html:/var/www/html
|
- ./data/html:/var/www/html
|
||||||
- ./data/logs/php:/var/www/logs
|
- ./data/logs/php:/var/www/logs
|
||||||
|
- ./data/nginx/conf.d/:/etc/nginx/conf.d/
|
||||||
|
- ./data/logs/nginx/:/var/log/nginx
|
||||||
|
- ./docker/nginx/default.conf.template:/etc/nginx/conf.d/default.conf
|
||||||
|
ports:
|
||||||
|
- "${APP_PORT}:80"
|
||||||
depends_on:
|
depends_on:
|
||||||
- mariadb
|
- mariadb
|
||||||
environment:
|
environment:
|
||||||
@ -33,31 +38,16 @@ services:
|
|||||||
BRANCH: ${REPO_BRANCH}
|
BRANCH: ${REPO_BRANCH}
|
||||||
APP_NAME: ${APP_NAME}
|
APP_NAME: ${APP_NAME}
|
||||||
APP_URL: ${APP_URL}
|
APP_URL: ${APP_URL}
|
||||||
DB_HOST: ${DB_HOST}
|
DB_HOST: mariadb
|
||||||
DB_PORT: ${DB_PORT}
|
DB_PORT: 3306
|
||||||
DB_DATABASE: ${DB_DATABASE}
|
DB_DATABASE: ${DB_DATABASE}
|
||||||
DB_USERNAME: ${DB_USERNAME}
|
DB_USERNAME: ${DB_USERNAME}
|
||||||
DB_PASSWORD: ${DB_PASSWORD}
|
DB_PASSWORD: ${DB_PASSWORD}
|
||||||
networks:
|
|
||||||
- app_network
|
|
||||||
|
|
||||||
nginx:
|
|
||||||
image: nginx:stable-alpine
|
|
||||||
container_name: ${APP_NAME}_nginx
|
|
||||||
ports:
|
|
||||||
- "80:80"
|
|
||||||
volumes:
|
|
||||||
- ./data/html:/var/www/html
|
|
||||||
- ./data/nginx/conf.d/:/etc/nginx/conf.d/
|
|
||||||
- ./data/logs/nginx/:/var/log/nginx
|
|
||||||
- ./docker/nginx/:/etc/nginx/templates
|
|
||||||
depends_on:
|
|
||||||
- app
|
|
||||||
environment:
|
|
||||||
NGINX_HOST: ${APP_DOMAIN}
|
NGINX_HOST: ${APP_DOMAIN}
|
||||||
NGINX_PORT: ${APP_PORT}
|
NGINX_PORT: 80
|
||||||
networks:
|
networks:
|
||||||
- app_network
|
- app_network
|
||||||
|
|
||||||
networks:
|
networks:
|
||||||
app_network:
|
app_network:
|
||||||
|
driver: bridge
|
@ -10,14 +10,13 @@ if [ -z "$(ls -A "$TARGET_DIR")" ]; then
|
|||||||
echo "[entrypoint] Cloning $BRANCH from $REPO_URL ..."
|
echo "[entrypoint] Cloning $BRANCH from $REPO_URL ..."
|
||||||
git clone --branch "$BRANCH" "$REPO_URL" "$TARGET_DIR"
|
git clone --branch "$BRANCH" "$REPO_URL" "$TARGET_DIR"
|
||||||
else
|
else
|
||||||
echo "[entrypoint] Repository already present, skipping first clone."
|
echo "[entrypoint] Repository already present, skipping clone."
|
||||||
fi
|
fi
|
||||||
|
|
||||||
cd "$TARGET_DIR"
|
cd "$TARGET_DIR"
|
||||||
|
|
||||||
# 2) Laravel 基礎安裝
|
# 2) Laravel 基礎安裝
|
||||||
composer install --no-interaction --prefer-dist
|
composer install --no-interaction --prefer-dist
|
||||||
|
|
||||||
[ -f .env ] || cp .env.example .env
|
[ -f .env ] || cp .env.example .env
|
||||||
|
|
||||||
update_env() { local k=$1 v=$2; grep -q "^$k=" .env && sed -i "s|^$k=.*|$k=$v|" .env || echo "$k=$v" >> .env; }
|
update_env() { local k=$1 v=$2; grep -q "^$k=" .env && sed -i "s|^$k=.*|$k=$v|" .env || echo "$k=$v" >> .env; }
|
||||||
@ -38,7 +37,7 @@ npm run build
|
|||||||
chown -R www-data:www-data storage bootstrap/cache
|
chown -R www-data:www-data storage bootstrap/cache
|
||||||
chmod -R 775 storage bootstrap/cache
|
chmod -R 775 storage bootstrap/cache
|
||||||
|
|
||||||
echo "[entrypoint] Starting supervisord ..."
|
mkdir -p /var/www/logs
|
||||||
supervisord -c /etc/supervisor/conf.d/supervisord.conf &
|
supervisord -c /etc/supervisor/conf.d/supervisord.conf &
|
||||||
|
php-fpm -D
|
||||||
exec "$@"
|
exec nginx -g "daemon off;"
|
||||||
|
@ -1,12 +1,12 @@
|
|||||||
server {
|
server {
|
||||||
listen ${NGINX_PORT};
|
listen 80;
|
||||||
server_name ${NGINX_HOST};
|
server_name ${NGINX_HOST};
|
||||||
|
|
||||||
client_max_body_size 100M;
|
|
||||||
|
|
||||||
root /var/www/html/public;
|
root /var/www/html/public;
|
||||||
index index.php index.html;
|
index index.php index.html;
|
||||||
|
|
||||||
|
client_max_body_size 100M;
|
||||||
|
|
||||||
access_log /var/log/nginx/access.log;
|
access_log /var/log/nginx/access.log;
|
||||||
error_log /var/log/nginx/error.log;
|
error_log /var/log/nginx/error.log;
|
||||||
|
|
||||||
@ -16,20 +16,9 @@ server {
|
|||||||
|
|
||||||
location ~ \.php$ {
|
location ~ \.php$ {
|
||||||
include fastcgi_params;
|
include fastcgi_params;
|
||||||
|
fastcgi_pass 127.0.0.1:9000;
|
||||||
fastcgi_pass app:9000;
|
|
||||||
fastcgi_index index.php;
|
fastcgi_index index.php;
|
||||||
|
|
||||||
# Laravel 正確位置
|
|
||||||
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
|
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
|
||||||
|
|
||||||
# Optional: 支援 PATH_INFO
|
|
||||||
fastcgi_param PATH_INFO $fastcgi_path_info;
|
|
||||||
fastcgi_param PATH_TRANSLATED $document_root$fastcgi_path_info;
|
|
||||||
|
|
||||||
# 避免 NGINX 直接 cache
|
|
||||||
fastcgi_buffer_size 16k;
|
|
||||||
fastcgi_buffers 4 16k;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
location ~ /\.ht {
|
location ~ /\.ht {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user