Commit cf96f79c by zhangxingmin

push

parent 019145a0
# 使用 Node 18 (兼容 Vue 2 的项目通常也可以运行在 Node 18 上) # 使用 Node 镜像构建
FROM docker.m.daocloud.io/library/node:18-bullseye AS build FROM node:14-alpine AS builder
# 安装 Python3(Node 18 不需要 Python2)
RUN apt-get update && apt-get install -y python3 && \
ln -s /usr/bin/python3 /usr/bin/python
# 环境变量与系统依赖
ENV npm_config_canvas_binary_host_mirror="https://npmmirror.com/mirrors/canvas" \
npm_config_sharp_binary_host="https://npmmirror.com/mirrors/sharp" \
npm_config_sharp_libvips_binary_host="https://npmmirror.com/mirrors/sharp-libvips" \
ESBUILD_BINARY_HOST="https://npmmirror.com/mirrors/esbuild"
# 安装构建依赖
RUN apt-get update && apt-get install -y --no-install-recommends \
build-essential pkg-config \
libcairo2-dev libpango1.0-dev libjpeg-dev libgif-dev librsvg2-dev libvips-dev \
&& rm -rf /var/lib/apt/lists/*
WORKDIR /app WORKDIR /app
COPY package.json package-lock.json ./ COPY package*.json ./
RUN npm install
# 优化npm安装流程
RUN npm set registry https://registry.npmmirror.com && \
npm config set sharp_binary_host https://npmmirror.com/mirrors/sharp && \
npm config set sharp_libvips_binary_host https://npmmirror.com/mirrors/sharp-libvips && \
npm cache clean --force && \
npm install --legacy-peer-deps --verbose
COPY . . COPY . .
RUN npm run build:test # 生成 dist/build/h5 目录
RUN npm run build
# Nginx 阶段保持不变...
# 最终阶段 - Nginx
FROM docker.m.daocloud.io/library/nginx:alpine
# 使用清华源替代阿里云源(Alpine镜像)
RUN sed -i 's/dl-cdn.alpinelinux.org/mirrors.tuna.tsinghua.edu.cn/g' /etc/apk/repositories && \
apk update && apk add --no-cache tzdata && \
cp /usr/share/zoneinfo/Asia/Shanghai /etc/localtime && \
echo "Asia/Shanghai" > /etc/timezone
COPY --from=build /app/dist /usr/share/nginx/html # 使用 Nginx 镜像运行
COPY nginx.conf /etc/nginx/conf.d/default.conf FROM nginx:1.21-alpine
COPY --from=builder /app/dist/build/h5 /usr/share/nginx/html
COPY nginx.conf /etc/nginx/conf.d/default.conf # 复制 Nginx 配置
EXPOSE 8333 EXPOSE 8333
CMD ["nginx", "-g", "daemon off;"] CMD ["nginx", "-g", "daemon off;"]
{ {
"name": "verification-code-input", "id": "vcode-input",
"version": "2.0.0", "name": "验证码输入框",
"private": true, "version": "2.0",
"description": "验证码输入框,密码输入框",
"keywords": [
"验证码输入框",
"支付密码输入框"
],
"displayName": "验证码输入框",
"dcloudext": {
"category": [
"前端组件",
"通用组件"
]
},
"scripts": { "scripts": {
"dev": "vite --host 0.0.0.0", "serve": "npm run dev:h5",
"build": "vite build --mode production", "build": "npm run build:h5",
"build:test": "vite build --mode test", "dev:h5": "uni -p h5",
"preview": "vite preview --port 4173" "build:h5": "uni build -p h5 --public-path ./"
}, },
"dependencies": { "dependencies": {
"crypto-js": "^4.2.0", "crypto-js": "^4.2.0",
"dayjs": "^1.11.13", "dayjs": "^1.11.13",
"echarts": "^5.6.0", "echarts": "^5.4.1",
"js-sha256": "^0.11.1", "js-sha256": "^0.11.1",
"nanoid": "^5.1.5", "nanoid": "^4.0.0",
"ali-oss": "^6.23.0",
"awesome-qr": "^2.1.5-rc.0",
"axios": "^1.11.0",
"benz-amr-recorder": "^1.1.5",
"clipboard": "^2.0.11",
"core-js": "^3.44.0",
"cos-js-sdk-v5": "^1.10.1",
"driver.js": "^1.3.6",
"fabric": "^5.3.0",
"file-saver": "^2.0.5",
"fuse.js": "^7.1.0",
"js-beautify": "^1.15.4",
"js-cookie": "^3.0.5",
"jsencrypt": "^3.3.2",
"lodash.merge": "^4.6.2",
"moment": "^2.30.1",
"mp4box": "^0.5.2",
"normalize.css": "^8.0.1",
"nprogress": "^0.2.0",
"path-browserify": "^1.0.1",
"pinia": "^2.0.32",
"qiankun": "^2.10.16",
"qrcode": "^1.5.3",
"quill-image-resize-module": "^3.0.0",
"screenfull": "^6.0.2",
"sortablejs": "^1.15.0",
"uuid": "^9.0.0",
"vant": "^3.6.14",
"vue": "^2.6.14",
"vue-router": "^3.6.5",
"vuedraggable": "^2.24.3",
"element-ui": "^2.15.14",
"vue-awesome": "^4.1.0",
"vue-quill": "^1.0.6",
"@dcloudio/uni-app": "^2.0.0", "@dcloudio/uni-app": "^2.0.0",
"vue-cropper": "^1.0.8", "@dcloudio/uni-h5": "^2.0.0",
"@vue/composition-api": "^1.7.1" "vue": "^2.6.14"
}, },
"devDependencies": { "devDependencies": {
"path": "^0.12.7", "less": "^4.3.0",
"less": "^4.4.0", "@dcloudio/vue-cli-plugin-uni": "^2.0.0",
"rollup-plugin-visualizer": "^5.9.2", "webpack": "^4.46.0"
"sass": "^1.62.1",
"sharp": "0.34.3",
"terser": "^5.17.7",
"vite": "^4.1.4",
"vite-plugin-cdn-import": "^0.3.5",
"vite-plugin-compression": "^0.5.1",
"vite-plugin-image-optimizer": "^1.1.6",
"vite-plugin-require-transform": "^1.0.21",
"vite-plugin-vue2": "^2.0.3",
"@vitejs/plugin-vue": "^4.0.0"
} }
} }
import { defineConfig } from 'vite';
import { createVuePlugin } from 'vite-plugin-vue2';
import { fileURLToPath, URL } from 'node:url';
export default defineConfig({
base: '/cffp/',
plugins: [
createVuePlugin({
// Vue 2 插件配置
jsx: true, // 启用 JSX 支持
})
],
resolve: {
alias: {
'@': fileURLToPath(new URL('./', import.meta.url)),
// Vue 2 兼容性别名
'vue': '@vue/compat',
'@vue/composition-api': '@vue/composition-api/dist/vue-composition-api.mjs'
}
},
css: {
preprocessorOptions: {
scss: {
additionalData: `@import "@/styles/variables.scss";`
}
}
},
build: {
outDir: 'dist',
assetsDir: 'assets',
minify: 'terser',
terserOptions: {
compress: {
drop_console: true
}
},
// Vue 2 需要额外的构建配置
commonjsOptions: {
transformMixedEsModules: true
}
},
// Vue 2 需要额外的优化配置
optimizeDeps: {
include: [
'@vue/composition-api',
'element-ui',
'vue-awesome'
]
}
});
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment