feat(deploy): configure czleilei240 integral shop
Add czleilei240 runtime profiles, frontend domains, contract paths, and Docker deployment updates so the integral shop can run against the Leilei environment. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -1,38 +1,24 @@
|
||||
# =============================================================
|
||||
# 寄卖商城 管理后台前端 (Vue 2 / Vue CLI 4)
|
||||
# build context = single-shop-22/backend-adminend
|
||||
# 多阶段: Node 构建 -> Nginx 运行;可通过 ARG VUE_APP_BASE_API 注入 API 域名
|
||||
#
|
||||
# 想直接使用源码里已有的 dist/: 用 --target=fast 构建
|
||||
# 积分商城 管理后台前端(Vue 2 SPA)
|
||||
# 纯 Nginx 运行时镜像,不含 Node 构建阶段
|
||||
# 静态文件由宿主机 bind-mount 进来(${SINGLE_ADMIN_WEB_DIR}:/usr/share/nginx/html)
|
||||
# 宿主机目录示例:/www/wwwroot/leilei-jfadmin.czchunfang.com/
|
||||
# 更新方式:rsync 新 dist 到宿主机目录 → 无需重建镜像
|
||||
# =============================================================
|
||||
# syntax=docker/dockerfile:1.6
|
||||
|
||||
# ---------- 构建阶段(默认) ----------
|
||||
FROM node:16-alpine AS builder
|
||||
FROM nginx:1.25-alpine
|
||||
|
||||
# 留空(默认)→ 浏览器走与 nginx 同域的 /api/;填具体 URL 则直连后端
|
||||
ARG VUE_APP_BASE_API=""
|
||||
ENV NODE_OPTIONS=--openssl-legacy-provider \
|
||||
NPM_CONFIG_REGISTRY=https://registry.npmmirror.com
|
||||
|
||||
WORKDIR /app
|
||||
COPY package.json yarn.lock* package-lock.json* ./
|
||||
RUN (yarn install --frozen-lockfile 2>/dev/null) || npm ci || npm install --legacy-peer-deps
|
||||
|
||||
COPY . .
|
||||
# 覆盖 .env.production,使用 build arg
|
||||
RUN printf "ENV='production'\nVUE_APP_BASE_API=%s\n" "$VUE_APP_BASE_API" > .env.production \
|
||||
&& npm run build:prod
|
||||
|
||||
# ---------- 运行阶段 ----------
|
||||
FROM nginx:1.25-alpine AS runtime
|
||||
ENV TZ=Asia/Shanghai
|
||||
RUN apk add --no-cache tzdata \
|
||||
|
||||
# 切换阿里云 Alpine 镜像源
|
||||
RUN sed -i 's/dl-cdn.alpinelinux.org/mirrors.aliyun.com/g' /etc/apk/repositories \
|
||||
&& apk add --no-cache tzdata \
|
||||
&& cp /usr/share/zoneinfo/$TZ /etc/localtime \
|
||||
&& echo $TZ > /etc/timezone
|
||||
|
||||
COPY --from=builder /app/dist /usr/share/nginx/html
|
||||
&& echo $TZ > /etc/timezone \
|
||||
&& rm -f /etc/apk/cache/*.apk
|
||||
|
||||
# Nginx 反代配置
|
||||
# /api/ 和 /adminapi/ 代理到 single-admin-api 容器
|
||||
RUN cat > /etc/nginx/conf.d/default.conf <<'NGX'
|
||||
server {
|
||||
listen 80;
|
||||
@@ -48,7 +34,6 @@ server {
|
||||
try_files $uri =404;
|
||||
}
|
||||
|
||||
# 反代到管理后台 API
|
||||
location /api/ {
|
||||
proxy_pass http://single-admin-api:30032/api/;
|
||||
proxy_http_version 1.1;
|
||||
@@ -60,7 +45,6 @@ server {
|
||||
client_max_body_size 50m;
|
||||
}
|
||||
|
||||
# CRMEB 部分接口直接命中 /adminapi (兼容)
|
||||
location /adminapi/ {
|
||||
proxy_pass http://single-admin-api:30032/adminapi/;
|
||||
proxy_set_header Host $host;
|
||||
@@ -75,14 +59,3 @@ server {
|
||||
NGX
|
||||
|
||||
EXPOSE 80
|
||||
|
||||
# ---------- 备选: 直接复用源码已构建的 dist/(fast 模式) ----------
|
||||
# 构建命令: docker compose build --target fast single-admin-web
|
||||
FROM nginx:1.25-alpine AS fast
|
||||
ENV TZ=Asia/Shanghai
|
||||
RUN apk add --no-cache tzdata \
|
||||
&& cp /usr/share/zoneinfo/$TZ /etc/localtime \
|
||||
&& echo $TZ > /etc/timezone
|
||||
COPY dist/ /usr/share/nginx/html
|
||||
COPY --from=runtime /etc/nginx/conf.d/default.conf /etc/nginx/conf.d/default.conf
|
||||
EXPOSE 80
|
||||
|
||||
Reference in New Issue
Block a user