移除docker部署相关文件,更新readme和开发文档

This commit is contained in:
2026-06-30 18:28:27 +08:00
parent 3c0aa59691
commit a1bd48dac3
11 changed files with 12 additions and 675 deletions
-36
View File
@@ -1,36 +0,0 @@
# Dependencies
node_modules/
.pnp
.pnp.js
# Build output
dist/
# IDE
.idea/
.vscode/
*.swp
*.swo
# Git
.git/
.gitignore
# Logs
*.log
npm-debug.log*
# OS
.DS_Store
Thumbs.db
# Env files
.env.local
.env.*.local
# Test
coverage/
# Misc
*.md
!README.md
-39
View File
@@ -1,39 +0,0 @@
# ============================================================
# 多阶段构建 (开发机有网络时使用)
# docker build -t weather-data-ui .
# ============================================================
FROM node:20-alpine AS builder
WORKDIR /app
# 安装依赖
COPY package.json package-lock.json* ./
RUN npm ci --registry=https://registry.npmmirror.com
# 复制源码并构建
COPY . .
RUN npm run build:prod
# ============================================================
# 运行阶段 - Nginx 提供静态文件服务
# ============================================================
FROM nginx:alpine
LABEL maintainer="weather-data"
LABEL description="Weather Data System - Frontend UI"
# 删除默认配置
RUN rm -f /etc/nginx/conf.d/default.conf
# 复制自定义 nginx 配置
COPY nginx.conf /etc/nginx/conf.d/default.conf
# 复制构建产物
COPY --from=builder /app/dist /usr/share/nginx/html
EXPOSE 80
HEALTHCHECK --interval=30s --timeout=5s --retries=3 \
CMD wget -qO- http://localhost/ || exit 1
CMD ["nginx", "-g", "daemon off;"]
-21
View File
@@ -1,21 +0,0 @@
# ============================================================
# 离线部署 Dockerfile (内网服务器使用)
# 前提:已将 dist/ 目录拷贝到当前路径
# docker build -f Dockerfile.offline -t weather-data-ui .
# ============================================================
FROM nginx:alpine
LABEL maintainer="weather-data"
LABEL description="Weather Data System - Frontend UI (offline)"
RUN rm -f /etc/nginx/conf.d/default.conf
COPY nginx.conf /etc/nginx/conf.d/default.conf
COPY dist /usr/share/nginx/html
EXPOSE 80
HEALTHCHECK --interval=30s --timeout=5s --retries=3 \
CMD wget -qO- http://localhost/ || exit 1
CMD ["nginx", "-g", "daemon off;"]
-62
View File
@@ -1,62 +0,0 @@
server {
listen 80;
server_name localhost;
charset utf-8;
# 访问日志 (生产环境可关闭 access_log 减少 IO)
access_log /var/log/nginx/access.log;
error_log /var/log/nginx/error.log warn;
# 站点根目录
root /usr/share/nginx/html;
index index.html;
# ============================================================
# SPA 路由处理:所有非静态资源请求返回 index.html
# 因为前端使用 hash router,这里主要是兜底
# ============================================================
location / {
try_files $uri $uri/ /index.html;
}
# ============================================================
# 静态资源缓存策略
# /assets/ 下的文件经过 Vite 处理带有 content hash,可长期缓存
# ============================================================
location /assets/ {
expires 1y;
add_header Cache-Control "public, immutable";
access_log off;
}
# ============================================================
# index.html 禁止缓存(确保前端更新后立即生效)
# ============================================================
location = /index.html {
add_header Cache-Control "no-cache, no-store, must-revalidate";
add_header Pragma "no-cache";
add_header Expires 0;
}
# ============================================================
# Gzip 压缩
# ============================================================
gzip on;
gzip_vary on;
gzip_proxied any;
gzip_comp_level 6;
gzip_min_length 1024;
gzip_types
text/plain
text/css
text/xml
text/javascript
application/javascript
application/json
application/xml
image/svg+xml;
# 隐藏 Nginx 版本号
server_tokens off;
}