Files
yunke/yunkes/Dockerfile
T
浅念 00ae13b5c2 feat(deploy): 完成数据迁移与MySQL全链路(14表698k消息100%一致+5方言补丁+bind mount)
- migrate_sqlite_to_mysql.py: 逐表清空重导(幂等),复用repos强转,JSON列
  解析,67万消息按msg_id键集分批,467s跑完14表全一致
- 修4个MySQL实测bug: NULLS LAST语法(compat.py编译补丁)、message.text
  TEXT→MEDIUMTEXT(64KB字节上限,实测20.8万字符车源清单)、URL列
  String(1024)→Text(分享链接超1KB)、垃圾超长member_id源头清理
- compose: media改bind mount(不占C盘Docker虚拟磁盘,实测2.5GB卷把
  C盘撑爆引擎500);mysql不映射宿主机3306
- 前端Dockerfile: npm ci→install(本地/容器npm版本锁漂移)
- 五服务实测:nginx→backend→MySQL全链路返回真实数据(客户6859/A**杰25条
  /搜索56条),媒体49536文件bind mount直读

Co-Authored-By: Claude <noreply@anthropic.com>
2026-08-22 12:40:44 +08:00

35 lines
1.3 KiB
Docker

# Frontend image: build the SPA with Node, serve the static dist with nginx.
#
# Multi-stage so the final image contains ONLY the compiled static assets +
# nginx — no Node toolchain shipped to production.
FROM node:20-alpine AS build
WORKDIR /app
# Install deps first (cache-friendly: only re-installs when package*.json
# changes; node_modules is never copied from the host via .dockerignore).
COPY package.json package-lock.json* ./
RUN npm install --no-audit --no-fund # ci 对锁同步严格,本地/容器 npm 版本差异致 EUSAGE
# Copy sources and build the production bundle into ./dist.
COPY tsconfig*.json vite.config.ts index.html ./
COPY public/ ./public/
COPY src/ ./src/
RUN npm run build
# --------------------------------------------------------------------------- #
# Runtime stage: nginx serves the static dist and reverse-proxies /api.
# --------------------------------------------------------------------------- #
FROM nginx:1.27-alpine
# Replace the default nginx config with our /api proxy + SPA fallback.
COPY nginx.conf /etc/nginx/conf.d/default.conf
# Copy the build output from the build stage into nginx's html root.
COPY --from=build /app/dist /usr/share/nginx/html
EXPOSE 80
# nginx foregrounds by default with the ``nginx -g 'daemon off;'`` directive
# already set on the official image; no CMD override needed.