diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..317c734 --- /dev/null +++ b/.dockerignore @@ -0,0 +1,7 @@ +node_modules +dist +.git +.gitignore +*.md +.vscode +.idea diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..ed5bcb9 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,29 @@ +# ── Stage 1: Build ────────────────────────────────── +FROM node:20-alpine AS builder + +WORKDIR /app + +# 先复制依赖描述文件,利用 Docker 缓存层 +COPY package.json package-lock.json* ./ + +# 安装依赖 +RUN npm install + +# 复制源码 +COPY . . + +# 构建生产包(tsc + vite build → dist/) +RUN npm run build + +# ── Stage 2: Serve ────────────────────────────────── +FROM nginx:alpine + +# 将构建产物复制到 Nginx 默认静态目录 +COPY --from=builder /app/dist /usr/share/nginx/html + +# 自定义 Nginx 配置:支持 SPA 路由 fallback + gzip +COPY nginx.conf /etc/nginx/conf.d/default.conf + +EXPOSE 80 + +CMD ["nginx", "-g", "daemon off;"] diff --git a/nginx.conf b/nginx.conf new file mode 100644 index 0000000..037a0b8 --- /dev/null +++ b/nginx.conf @@ -0,0 +1,29 @@ +server { + listen 80; + server_name localhost; + + root /usr/share/nginx/html; + index index.html; + + # gzip 压缩 + gzip on; + gzip_types text/plain text/css application/json application/javascript text/xml application/xml text/javascript image/svg+xml; + gzip_min_length 256; + + # SPA 路由 fallback:所有非文件请求回退到 index.html + location / { + try_files $uri $uri/ /index.html; + } + + # 静态资源长缓存(Vite 构建产物带 hash) + location /assets/ { + expires 1y; + add_header Cache-Control "public, immutable"; + } + + # SVG / 图片缓存 + location ~* \.(svg|png|jpg|jpeg|gif|ico|webp)$ { + expires 30d; + add_header Cache-Control "public"; + } +} diff --git a/postcss.config.js b/postcss.config.js new file mode 100644 index 0000000..2e7af2b --- /dev/null +++ b/postcss.config.js @@ -0,0 +1,6 @@ +export default { + plugins: { + tailwindcss: {}, + autoprefixer: {}, + }, +} diff --git a/public/bexell/logo.png b/public/bexell/logo.png new file mode 100644 index 0000000..3d7c81f Binary files /dev/null and b/public/bexell/logo.png differ diff --git a/public/bomx/logo.png b/public/bomx/logo.png new file mode 100644 index 0000000..fc51b6b Binary files /dev/null and b/public/bomx/logo.png differ diff --git a/public/digiwin.svg b/public/digiwin.svg new file mode 100644 index 0000000..c8310c1 --- /dev/null +++ b/public/digiwin.svg @@ -0,0 +1 @@ + diff --git a/public/favicon.ico b/public/favicon.ico new file mode 100644 index 0000000..58540ae Binary files /dev/null and b/public/favicon.ico differ diff --git a/public/ology-logo-1.png b/public/ology-logo-1.png new file mode 100644 index 0000000..d271db6 Binary files /dev/null and b/public/ology-logo-1.png differ diff --git a/public/ology-logo.png b/public/ology-logo.png new file mode 100644 index 0000000..809d25c Binary files /dev/null and b/public/ology-logo.png differ diff --git a/public/regal-rexnord-logo.png b/public/regal-rexnord-logo.png new file mode 100644 index 0000000..06bea24 Binary files /dev/null and b/public/regal-rexnord-logo.png differ diff --git a/public/wenzhou-city-logo.png b/public/wenzhou-city-logo.png new file mode 100644 index 0000000..dad6712 Binary files /dev/null and b/public/wenzhou-city-logo.png differ diff --git a/public/xinmo-logo.png b/public/xinmo-logo.png new file mode 100644 index 0000000..764fb42 Binary files /dev/null and b/public/xinmo-logo.png differ