添加docker 部署agent

This commit is contained in:
2026-04-13 17:06:02 +08:00
parent 797824d01c
commit a7c2448207
2866 changed files with 1149 additions and 272838 deletions

View File

@@ -1,5 +1,9 @@
FROM php:8.1-apache
# 切换为阿里云 Debian 镜像源(加速国内构建)
RUN sed -i 's|http://deb.debian.org|https://mirrors.aliyun.com|g' /etc/apt/sources.list.d/debian.sources 2>/dev/null || \
sed -i 's|http://deb.debian.org|https://mirrors.aliyun.com|g' /etc/apt/sources.list
# 安装 PHP 扩展
RUN apt-get update && apt-get install -y \
libzip-dev \
@@ -24,6 +28,9 @@ RUN sed -i '/<Directory \/var\/www\/>/,/<\/Directory>/ s/AllowOverride None/Allo
# 设置时区
RUN ln -sf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime
# 关闭 PHP 错误输出到响应体,开启输出缓冲(与 Windows 行为一致)
RUN echo 'display_errors = Off\nerror_reporting = E_ALL & ~E_DEPRECATED & ~E_STRICT\noutput_buffering = 4096\nlog_errors = On\nerror_log = /var/log/apache2/php_errors.log' > /usr/local/etc/php/conf.d/production.ini
# 拷贝应用代码
COPY api/ /var/www/html/
COPY env_config.php /var/www/env_config.php

View File

@@ -9,6 +9,10 @@ set -e
echo "[entrypoint] Replacing hardcoded domains in JS files..."
# 默认值(与 .env.example 对应)
# 从 ROOT_DOMAIN 推导子域名docker-compose.yml 通常已注入,这里仅作容器外单跑的兜底)
_ROOT="${ROOT_DOMAIN:-daoqijuyou77.cn}"
SITE_API_URL="${SITE_API_URL:-https://api.${_ROOT}}"
SITE_PAY_NOTIFY_URL="${SITE_PAY_NOTIFY_URL:-https://api.${_ROOT}}"
SITE_API2_URL="${SITE_API2_URL:-https://api2.tscce.cn}"
QQ_CALLBACK_URL="${QQ_CALLBACK_URL:-http://syhd.daoqijuyou77.cn}"
@@ -28,8 +32,6 @@ if [ -f "$QQ_INC" ]; then
fi
# 替换 sample 目录中的硬编码域名
SITE_API_URL="${SITE_API_URL:-https://api.tscce.cn}"
SITE_PAY_NOTIFY_URL="${SITE_PAY_NOTIFY_URL:-http://api.daoqijuyou77.cn}"
for f in /var/www/html/sample/onlinepay/js/common.js; do
if [ -f "$f" ]; then
sed -i "s|var g_RequestAddress = 'https://api.tscce.cn'|var g_RequestAddress = '${SITE_API_URL}'|g" "$f"

View File

@@ -1,5 +1,9 @@
FROM php:8.1-apache
# 切换为阿里云 Debian 镜像源(加速国内构建)
RUN sed -i 's|http://deb.debian.org|https://mirrors.aliyun.com|g' /etc/apt/sources.list.d/debian.sources 2>/dev/null || \
sed -i 's|http://deb.debian.org|https://mirrors.aliyun.com|g' /etc/apt/sources.list
# 安装 PHP 扩展(包含 Redis
RUN apt-get update && apt-get install -y \
libzip-dev \
@@ -26,6 +30,9 @@ RUN sed -i '/<Directory \/var\/www\/>/,/<\/Directory>/ s/AllowOverride None/Allo
# 设置时区
RUN ln -sf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime
# 关闭 PHP 错误输出到响应体,开启输出缓冲(与 Windows 行为一致)
RUN echo 'display_errors = Off\nerror_reporting = E_ALL & ~E_DEPRECATED & ~E_STRICT\noutput_buffering = 4096\nlog_errors = On\nerror_log = /var/log/apache2/php_errors.log' > /usr/local/etc/php/conf.d/production.ini
# 拷贝应用代码
COPY dlweb/ /var/www/html/
COPY env_config.php /var/www/env_config.php

View File

@@ -8,15 +8,18 @@ set -e
echo "[entrypoint] Replacing hardcoded domains in JS/HTML files..."
# 从 ROOT_DOMAIN 推导子域名docker-compose.yml 通常已注入,这里仅作容器外单跑的兜底)
_ROOT="${ROOT_DOMAIN:-daoqijuyou77.cn}"
# 从环境变量读取,提供默认值
# DLWEB_API_BASE_URL 和 DLWEB_SDK_API_URL 从 API_DOMAIN / DLWEB_DOMAIN 自动推导
DLWEB_API_BASE_URL="https://${API_DOMAIN:-api.daoqijuyou77.cn}"
DLWEB_API_BASE_URL="https://${DLWEB_DOMAIN:-dlapi.${_ROOT}}"
DLWEB_SETTLE_URL="${DLWEB_SETTLE_URL:-http://dlsettle.daoqijuyou77.cn/mobile/}"
DLWEB_AVATAR_URL="${DLWEB_AVATAR_URL:-https://dlwebv3.tscce.cn/images/noavatar.png}"
DLWEB_SDK_API_URL="https://${DLWEB_DOMAIN:-dlapi.daoqijuyou77.cn}"
DLWEB_SDK_API_URL="https://${API_DOMAIN:-api.${_ROOT}}"
DLWEB_SDK_API2_URL="${DLWEB_SDK_API2_URL:-https://api2.tscce.cn}"
DLWEB_PROXY_URL="${DLWEB_PROXY_URL:-https://proxytest.tscce.cn}"
DLWEB_DL_API_V3_URL="${DLWEB_DL_API_V3_URL:-https://dlapiv3.tscce.cn}"
DLWEB_DL_API_V3_URL="${DLWEB_DL_API_V3_URL:-https://dlapi.${_ROOT}}"
DLWEB_WEB_DOMAIN="${DLWEB_WEB_DOMAIN:-https://dlwebv3.tscce.cn}"
DLWEB_SETTLE_FULL_URL="${DLWEB_SETTLE_FULL_URL:-http://dlsettle.tscce.cn}"
DLWEB_OPERATE_URL="${DLWEB_OPERATE_URL:-https://operate.daoqijuyou77.cn}"

View File

@@ -46,6 +46,34 @@ upstream wxserver_service {
# 注意: ssl-params.conf 由 init-ssl.sh 生成到
# /etc/nginx/snippets/ssl-params.conf
# ===== 父域名 HTTP 专用(微信业务域名验证文件 + 其余跳转 API =====
# 父域名无需 HTTPS仅用于 MP_verify_*.txt 的 HTTP 访问
server {
listen 80;
listen [::]:80;
server_name ${ROOT_DOMAIN} www.${ROOT_DOMAIN};
# Let's Encrypt ACME 验证(保留,以防日后为父域名申请证书)
location /.well-known/acme-challenge/ {
root /var/www/certbot;
}
# 微信业务域名验证文件(代理到 api 容器)
location ~* ^/MP_verify_.*\.txt$ {
proxy_pass http://api_service;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header X-Forwarded-Port $server_port;
}
# 其余流量重定向到 API 子域名
location / {
return 301 https://${API_DOMAIN}$request_uri;
}
}
# ===== HTTP → HTTPS 统一重定向 + ACME 验证 =====
server {
listen 80 default_server;
@@ -85,6 +113,7 @@ server {
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header X-Forwarded-Port $server_port;
}
}
@@ -104,6 +133,7 @@ server {
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header X-Forwarded-Port $server_port;
}
}
@@ -123,6 +153,7 @@ server {
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header X-Forwarded-Port $server_port;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";

View File

@@ -1,20 +1,23 @@
FROM node:18-alpine
WORKDIR /app
# 切换阿里云 Alpine 镜像源(解决国内拉取 apk 包极慢的问题)
RUN sed -i 's|https://dl-cdn.alpinelinux.org|https://mirrors.aliyun.com|g' /etc/apk/repositories
# 安装依赖
COPY wxserver_daoqi/package.json ./
RUN npm install --production
# 拷贝应用代码
COPY wxserver_daoqi/ ./
# 设置时区
# 设置时区(放在最前,避免后续步骤受 apk 慢影响)
RUN apk add --no-cache tzdata \
&& cp /usr/share/zoneinfo/Asia/Shanghai /etc/localtime \
&& echo "Asia/Shanghai" > /etc/timezone \
&& apk del tzdata
WORKDIR /app
# 安装依赖(使用淘宝 npm 镜像加速)
COPY wxserver_daoqi/package.json ./
RUN npm install --production --registry=https://registry.npmmirror.com
# 拷贝应用代码
COPY wxserver_daoqi/ ./
EXPOSE 3000
CMD ["node", "index.js"]