Commit 08456d6a by zhangxingmin

push

parent 53718bc1
# 构建阶段 # 构建阶段
FROM node:16-alpine AS builder FROM node:16.20.2-alpine3.18 AS builder
# 设置环境变量
ENV NODE_ENV=production
ENV H5_BASE=/
# 解决时区问题
RUN apk add --no-cache tzdata && \
cp /usr/share/zoneinfo/Asia/Shanghai /etc/localtime && \
echo "Asia/Shanghai" > /etc/timezone
WORKDIR /app WORKDIR /app
# 复制依赖文件并安装
COPY package*.json ./ COPY package*.json ./
RUN npm install --registry=https://registry.npmmirror.com RUN npm config set registry https://registry.npmmirror.com && \
npm install --legacy-peer-deps --no-optional
# 复制源代码
COPY . . COPY . .
RUN npm run build:h5
# 构建项目
RUN npm run build
# 生产运行阶段 # 生产运行阶段
FROM nginx:1.21-alpine FROM nginx:1.25.2-alpine
# 删除默认配置 # 删除默认配置
RUN rm -rf /etc/nginx/conf.d/default.conf RUN rm -rf /etc/nginx/conf.d/default.conf
...@@ -20,5 +35,8 @@ COPY nginx.conf /etc/nginx/conf.d ...@@ -20,5 +35,8 @@ COPY nginx.conf /etc/nginx/conf.d
# 从构建阶段复制产物 # 从构建阶段复制产物
COPY --from=builder /app/dist/build/h5 /usr/share/nginx/html COPY --from=builder /app/dist/build/h5 /usr/share/nginx/html
# 暴露端口
EXPOSE 8333 EXPOSE 8333
# 启动Nginx
CMD ["nginx", "-g", "daemon off;"] CMD ["nginx", "-g", "daemon off;"]
...@@ -3,6 +3,7 @@ ...@@ -3,6 +3,7 @@
"name": "verification-code-input", "name": "verification-code-input",
"version": "2.0.0", "version": "2.0.0",
"description": "验证码输入框,密码输入框", "description": "验证码输入框,密码输入框",
"private": true,
"keywords": [ "keywords": [
"验证码输入框", "验证码输入框",
"支付密码输入框" "支付密码输入框"
...@@ -14,24 +15,41 @@ ...@@ -14,24 +15,41 @@
"通用组件" "通用组件"
] ]
}, },
"scripts": {
"build": "uni build -p h5",
"analyze": "uni build -p h5 --analyze",
"lint": "eslint --ext .js,.vue src",
"test": "jest"
},
"dependencies": { "dependencies": {
"@dcloudio/uni-app": "^3.0.0-30720220613001",
"crypto-js": "^4.2.0", "crypto-js": "^4.2.0",
"dayjs": "^1.11.13", "dayjs": "^1.11.13",
"echarts": "^5.4.1", "echarts": "^5.4.1",
"js-sha256": "^0.11.1", "js-sha256": "^0.11.1",
"nanoid": "^4.0.0", "nanoid": "^4.0.0",
"@dcloudio/uni-app": "^3.0.0",
"vue": "^2.6.14" "vue": "^2.6.14"
}, },
"devDependencies": { "devDependencies": {
"@babel/core": "^7.22.5",
"@dcloudio/uni-h5": "^3.0.0-30720220613001",
"@dcloudio/vue-cli-plugin-uni": "^3.0.0-30720220613001",
"@vue/cli-plugin-babel": "^4.5.19",
"@vue/cli-plugin-eslint": "^4.5.19",
"@vue/eslint-config-standard": "^6.1.0",
"eslint": "^7.32.0",
"eslint-plugin-vue": "^7.20.0",
"jest": "^29.6.2",
"less": "^4.3.0", "less": "^4.3.0",
"@dcloudio/uni-h5": "^3.0.0", "less-loader": "^10.0.1",
"@dcloudio/vue-cli-plugin-uni": "^3.0.0", "postcss-pxtorem": "^6.0.0",
"webpack": "^4.46.0" "vue-jest": "^5.0.0",
"webpack": "^4.46.0",
"webpack-bundle-analyzer": "^4.8.0"
}, },
"scripts": { "browserslist": [
"dev": "uni -p h5", "> 1%",
"build:h5": "uni build -p h5", "last 2 versions",
"test": "echo \"Error: no test specified\" && exit 1" "not dead"
} ]
} }
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