diff --git a/.dockerignore b/.dockerignore index 52b833a9..a89d50d9 100644 --- a/.dockerignore +++ b/.dockerignore @@ -1,7 +1,7 @@ -node_modules +**/node_modules .git .gitignore *.md -dist +**/dist .turbo dist.zip diff --git a/apps/web-antd/Dockerfile b/apps/web-antd/Dockerfile new file mode 100644 index 00000000..72f1f7b2 --- /dev/null +++ b/apps/web-antd/Dockerfile @@ -0,0 +1,21 @@ +FROM node:lts-alpine AS base +ENV PNPM_HOME="/pnpm" +ENV PATH="$PNPM_HOME:$PATH" +ENV NODE_ENV=production +ARG NPM_CONFIG_REGISTRY=https://registry.npmmirror.com +RUN npm config set registry ${NPM_CONFIG_REGISTRY} +RUN corepack enable +WORKDIR /app + +FROM base AS builder +COPY . . +RUN pnpm i --frozen-lockfile +ARG RELATIVE_PATH=/ +ARG BASE_URI= +RUN pnpm run build:antd -- --base=${RELATIVE_PATH}${BASE_URI} + +FROM nginx:stable-alpine +ARG BASE_URI= +COPY --from=builder /app/apps/web-antd/dist /usr/share/nginx/html/${BASE_URI} +COPY --from=builder /app/scripts/deploy/nginx.conf /etc/nginx/nginx.conf +EXPOSE 8080 diff --git a/apps/web-antd/Jenkinsfile b/apps/web-antd/Jenkinsfile new file mode 100644 index 00000000..03964135 --- /dev/null +++ b/apps/web-antd/Jenkinsfile @@ -0,0 +1,39 @@ +#!/usr/bin/env groovy +pipeline { + agent any + stages { + stage('build') { + steps { + script { + file_contents = ''' + VITE_GLOB_API_URL=/ruoyi-vue-pro + ''' + write_file_path = "apps/web-antd/.env.production.local" + writeFile file: write_file_path, text: file_contents, encoding: 'UTF-8' + } + script{ + sh "docker build -f apps/web-antd/Dockerfile --build-arg BASE_URI=yudao-ui-admin/ -t $IMAGE_PATH ." + } + } + } + stage('deploy') { + steps { + script{ + sh 'docker push $IMAGE_PATH' + } + } + } + } + post { + success { + sh """ + curl -X POST "${params.API_URL}/success" + """ + } + failure { + sh """ + curl -X POST "${params.API_URL}/failure" + """ + } + } +} diff --git a/apps/web-antd/src/components/Tinyflow/index.ts b/apps/web-antd/src/components/Tinyflow/index.ts index 33db19a5..e014e38c 100644 --- a/apps/web-antd/src/components/Tinyflow/index.ts +++ b/apps/web-antd/src/components/Tinyflow/index.ts @@ -1,2 +1,2 @@ -export { default as Tinyflow } from './tinyflow.vue'; +export { default as Tinyflow } from './Tinyflow.vue'; export * from './ui/typing'; diff --git a/apps/web-antd/src/views/ai/workflow/form/modules/workflow-design.vue b/apps/web-antd/src/views/ai/workflow/form/modules/workflow-design.vue index 6659b80b..fb4ec8cf 100644 --- a/apps/web-antd/src/views/ai/workflow/form/modules/workflow-design.vue +++ b/apps/web-antd/src/views/ai/workflow/form/modules/workflow-design.vue @@ -10,7 +10,7 @@ import { isNumber } from '@vben/utils'; import { Button, Input, Select } from 'ant-design-vue'; import { testWorkflow } from '#/api/ai/workflow'; -import { Tinyflow } from '#/components/tinyflow'; +import { Tinyflow } from '#/components/Tinyflow'; defineProps<{ provider: any; diff --git a/apps/web-antd/vite.config.mts b/apps/web-antd/vite.config.mts index 71ae65bb..70e2f28b 100644 --- a/apps/web-antd/vite.config.mts +++ b/apps/web-antd/vite.config.mts @@ -1,16 +1,17 @@ import { defineConfig } from '@vben/vite-config'; +import { loadEnv } from 'vite'; -export default defineConfig(async () => { +export default defineConfig(async ({ mode }) => { + const env = loadEnv(mode, process.cwd()); return { application: {}, vite: { server: { proxy: { - '/admin-api': { + [env.VITE_GLOB_API_URL]: { changeOrigin: true, - rewrite: (path) => path.replace(/^\/admin-api/, ''), // mock代理目标地址 - target: 'http://localhost:48080/admin-api', + target: env.VITE_BASE_URL, ws: true, }, },