Parcourir la source

feat(components): cicd5

Yi il y a 5 mois
Parent
commit
f243b05c3a
5 fichiers modifiés avec 20 ajouts et 46 suppressions
  1. 10 7
      Dockerfile
  2. 1 2
      mock/api/index.ts
  3. 0 33
      mock/api/management.ts
  4. 1 1
      package.json
  5. 8 3
      src/service/request/index.ts

+ 10 - 7
Dockerfile

@@ -1,14 +1,17 @@
-FROM node:latest as build
+FROM node:18.12-alpine as build
 WORKDIR /app/kpt-system-web
+ENV NODE_OPTIONS="--max-old-space-size=4096"
 COPY . .
-RUN npm install -g pnpm
-RUN pnpm install
+RUN mkdir -p /root/.local/share/pnpm/store/v3/files && chown -R $(whoami) /root/.local/share/pnpm/store/v3/
+RUN npm install -g pnpm && npm install -g typescript@5.1.6
+RUN echo "declare module 'lodash-es';" > types.d.ts
+RUN pnpm config set registry https://registry.npmmirror.com
+RUN pnpm update vue-demi@latest
+RUN pnpm install --fetch-timeout 60000
 RUN pnpm build 
-RUN ls -l && pwd
 
 FROM nginx:alpine as prod
 WORKDIR /app/kpt-system-web
-RUN ls -l && pwd
-COPY --from=build ./dist/ /usr/share/nginx/html/
-COPY --from=build ./nginx.conf /etc/nginx/conf.d/default.conf
+COPY --from=build /app/kpt-system-web/dist/ /usr/share/nginx/html/
+COPY --from=build /app/kpt-system-web/nginx.conf /etc/nginx/conf.d/default.conf
 EXPOSE 80

+ 1 - 2
mock/api/index.ts

@@ -1,5 +1,4 @@
 import auth from './auth';
 import route from './route';
-import management from './management';
 
-export default [...auth, ...route, ...management];
+export default [...auth, ...route];

+ 0 - 33
mock/api/management.ts

@@ -1,33 +0,0 @@
-import { mock } from 'mockjs';
-import type { MockMethod } from 'vite-plugin-mock';
-
-const apis: MockMethod[] = [
-  {
-    url: '/mock/getAllUserList',
-    method: 'post',
-    response: (): Service.MockServiceResult<ApiUserManagement.User[]> => {
-      const data = mock({
-        'list|1000': [
-          {
-            id: '@id',
-            userName: '@cname',
-            'age|18-56': 56,
-            'gender|1': ['0', '1', null],
-            phone:
-              /^[1](([3][0-9])|([4][01456789])|([5][012356789])|([6][2567])|([7][0-8])|([8][0-9])|([9][012356789]))[0-9]{8}$/,
-            'email|1': ['@email("qq.com")', null],
-            'userStatus|1': ['1', '2', '3', '4', null]
-          }
-        ]
-      });
-
-      return {
-        code: 200,
-        message: 'ok',
-        data: data.list
-      };
-    }
-  }
-];
-
-export default apis;

+ 1 - 1
package.json

@@ -70,7 +70,7 @@
     "form-data": "^4.0.0",
     "lodash-es": "^4.17.21",
     "naive-ui": "2.34.3",
-    "pinia": "^2.0.33",
+    "pinia": "2.0.36",
     "print-js": "^1.6.0",
     "qs": "^6.11.1",
     "swiper": "^9.1.0",

+ 8 - 3
src/service/request/index.ts

@@ -5,9 +5,14 @@ const { url, proxyPattern } = getServiceEnvConfig(import.meta.env);
 
 const isHttpProxy = import.meta.env.VITE_HTTP_PROXY === 'Y';
 
-export const request = createRequest({ baseURL: isHttpProxy ? proxyPattern : url });
+export const request = createRequest({
+  baseURL: isHttpProxy ? proxyPattern : url
+});
 
 export const mockRequest = createRequest({ baseURL: '/mock' });
 
-// export const backgroundRequest = createRequest({ baseURL: 'http://vernamq8085.kptyun.com/api/v1' });
-export const backgroundRequest = createRequest({ baseURL: 'http://192.168.1.96:8000/api/v1' });
+export const backgroundRequest = createRequest({
+  baseURL: 'http://vernamq8085.kptyun.com/api/v1'
+});
+/* export const backgroundRequest = createRequest({ baseURL: 'http://192.168.1.96:8000/api/v1' });
+ */