v0.0.2 app,nginx 合併 20250610 #1
10
.env.example
10
.env.example
@ -1,15 +1,13 @@
|
||||
# Project
|
||||
APP_NAME=ktvcentral
|
||||
APP_DOMAIN=zqd.superstar.dnsnet.cc
|
||||
APP_PORT=80
|
||||
APP_URL=http://zqd.superstar.dnsnet.cc/
|
||||
APP_PORT=8080
|
||||
APP_URL=http://${APP_DOMAIN}:${APP_PORT}
|
||||
|
||||
REPO_URL="http://47.251.18.130:3000/Leecheng/KTVCentral.git"
|
||||
REPO_BRANCH="main"
|
||||
REPO_URL=http://47.251.18.130:3000/Leecheng/KTVCentral.git
|
||||
REPO_BRANCH=main
|
||||
|
||||
# Database
|
||||
DB_HOST=mariadb
|
||||
DB_PORT=3306
|
||||
DB_DATABASE=KaraokeKingpin
|
||||
DB_USERNAME=KaraokeKingpin
|
||||
DB_PASSWORD=ESM7yTPMnavFmbBH
|
||||
|
@ -2,6 +2,7 @@ FROM php:8.3-fpm
|
||||
|
||||
# ---- system & PHP extensions -------------------------------------------------
|
||||
RUN apt-get update && apt-get install -y \
|
||||
nginx \
|
||||
git unzip zip curl ca-certificates supervisor cron nano \
|
||||
libpng-dev libjpeg62-turbo-dev libfreetype6-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/entrypoint.sh /entrypoint.sh
|
||||
COPY docker/entrypoint.git.sh /entrypoint.git.sh
|
||||
COPY docker/nginx/default.conf.template /etc/nginx/conf.d/default.conf
|
||||
|
||||
WORKDIR /var/www
|
||||
|
||||
RUN chmod +x /entrypoint.sh /entrypoint.git.sh
|
||||
ENTRYPOINT ["/entrypoint.sh"]
|
||||
CMD ["docker-php-entrypoint", "php-fpm"]
|
@ -26,6 +26,11 @@ services:
|
||||
volumes:
|
||||
- ./data/html:/var/www/html
|
||||
- ./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:
|
||||
- mariadb
|
||||
environment:
|
||||
@ -33,31 +38,16 @@ services:
|
||||
BRANCH: ${REPO_BRANCH}
|
||||
APP_NAME: ${APP_NAME}
|
||||
APP_URL: ${APP_URL}
|
||||
DB_HOST: ${DB_HOST}
|
||||
DB_PORT: ${DB_PORT}
|
||||
DB_HOST: mariadb
|
||||
DB_PORT: 3306
|
||||
DB_DATABASE: ${DB_DATABASE}
|
||||
DB_USERNAME: ${DB_USERNAME}
|
||||
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_PORT: ${APP_PORT}
|
||||
NGINX_PORT: 80
|
||||
networks:
|
||||
- app_network
|
||||
|
||||
networks:
|
||||
app_network:
|
||||
driver: bridge
|
@ -10,14 +10,13 @@ if [ -z "$(ls -A "$TARGET_DIR")" ]; then
|
||||
echo "[entrypoint] Cloning $BRANCH from $REPO_URL ..."
|
||||
git clone --branch "$BRANCH" "$REPO_URL" "$TARGET_DIR"
|
||||
else
|
||||
echo "[entrypoint] Repository already present, skipping first clone."
|
||||
echo "[entrypoint] Repository already present, skipping clone."
|
||||
fi
|
||||
|
||||
cd "$TARGET_DIR"
|
||||
|
||||
# 2) Laravel 基礎安裝
|
||||
composer install --no-interaction --prefer-dist
|
||||
|
||||
[ -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; }
|
||||
@ -38,7 +37,7 @@ npm run build
|
||||
chown -R www-data:www-data 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 &
|
||||
|
||||
exec "$@"
|
||||
php-fpm -D
|
||||
exec nginx -g "daemon off;"
|
||||
|
@ -1,12 +1,12 @@
|
||||
server {
|
||||
listen ${NGINX_PORT};
|
||||
listen 80;
|
||||
server_name ${NGINX_HOST};
|
||||
|
||||
client_max_body_size 100M;
|
||||
|
||||
root /var/www/html/public;
|
||||
index index.php index.html;
|
||||
|
||||
client_max_body_size 100M;
|
||||
|
||||
access_log /var/log/nginx/access.log;
|
||||
error_log /var/log/nginx/error.log;
|
||||
|
||||
@ -16,20 +16,9 @@ server {
|
||||
|
||||
location ~ \.php$ {
|
||||
include fastcgi_params;
|
||||
|
||||
fastcgi_pass app:9000;
|
||||
fastcgi_pass 127.0.0.1:9000;
|
||||
fastcgi_index index.php;
|
||||
|
||||
# Laravel 正確位置
|
||||
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 {
|
||||
|
Loading…
x
Reference in New Issue
Block a user