添加docker-compose.dev
This commit is contained in:
64
web/Dockerfile
Normal file
64
web/Dockerfile
Normal file
@@ -0,0 +1,64 @@
|
||||
# syntax=docker/dockerfile:1
|
||||
|
||||
####################
|
||||
# 构建阶段
|
||||
####################
|
||||
FROM node:22.17.0 AS build
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
# 先拷贝依赖文件
|
||||
COPY package.json ./
|
||||
|
||||
# 启用 corepack + 设置 registry
|
||||
RUN corepack enable \
|
||||
&& corepack prepare pnpm@latest --activate \
|
||||
&& pnpm config set registry https://registry.npmjs.org/ \
|
||||
&& pnpm install
|
||||
|
||||
# 再拷贝源码
|
||||
COPY . .
|
||||
|
||||
# 编译
|
||||
RUN pnpm run build:antd
|
||||
|
||||
####################
|
||||
# 生产阶段
|
||||
####################
|
||||
FROM nginx:alpine AS prod
|
||||
|
||||
# 拷贝编译后的静态文件到 nginx
|
||||
COPY --from=build /app/dist /usr/share/nginx/html
|
||||
|
||||
# 拷贝 nginx 配置
|
||||
COPY nginx.conf /etc/nginx/conf.d/default.conf
|
||||
|
||||
|
||||
####################
|
||||
# 开发阶段
|
||||
####################
|
||||
FROM node:22.17.0 AS dev
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
# 拷贝项目
|
||||
COPY . .
|
||||
|
||||
# 如果有私有 registry
|
||||
COPY .npmrc .npmrc
|
||||
|
||||
# 安装 pnpm(官方推荐 corepack,更好)
|
||||
RUN corepack enable \
|
||||
&& corepack prepare pnpm@latest --activate
|
||||
|
||||
# 安装依赖(一定要在 monorepo 根目录,保证 workspace 有效)
|
||||
RUN pnpm i
|
||||
|
||||
# 设置前端工作目录(根据实际情况修改)
|
||||
WORKDIR /app/apps/web-antd
|
||||
|
||||
# 暴露前端 dev server 端口
|
||||
EXPOSE 5678
|
||||
|
||||
# 默认启动 dev server
|
||||
CMD ["pnpm", "run", "dev:antd"]
|
||||
8
web/apps/web-antd/.env
Normal file
8
web/apps/web-antd/.env
Normal file
@@ -0,0 +1,8 @@
|
||||
# 应用标题
|
||||
VITE_APP_TITLE=Django Vue Admin
|
||||
|
||||
# 应用命名空间,用于缓存、store等功能的前缀,确保隔离
|
||||
VITE_APP_NAMESPACE=django-vue-admin
|
||||
|
||||
# 对store进行加密的密钥,在将store持久化到localStorage时会使用该密钥进行加密
|
||||
VITE_APP_STORE_SECURE_KEY=d41d8cd98f00b204e9800998ecf8427e
|
||||
@@ -90,7 +90,12 @@ function onActionClick({
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
const expandAll = () => {
|
||||
gridApi.grid?.setAllTreeExpand(true);
|
||||
};
|
||||
const collapseAll = () => {
|
||||
gridApi.grid?.setAllTreeExpand(false);
|
||||
};
|
||||
const [Grid, gridApi] = useVbenVxeGrid({
|
||||
gridEvents: {},
|
||||
gridOptions: {
|
||||
@@ -134,6 +139,12 @@ function refreshGrid() {
|
||||
<FormModal @success="refreshGrid" />
|
||||
<Grid table-title="部门列表">
|
||||
<template #toolbar-tools>
|
||||
<Button class="mr-2" type="primary" @click="expandAll">
|
||||
展开全部
|
||||
</Button>
|
||||
<Button class="mr-2" type="primary" @click="collapseAll">
|
||||
折叠全部
|
||||
</Button>
|
||||
<Button
|
||||
type="primary"
|
||||
@click="onCreate"
|
||||
|
||||
@@ -90,7 +90,12 @@ function onCreate() {
|
||||
function onAppend(row: SystemMenuApi.SystemMenu) {
|
||||
formDrawerApi.setData({ pid: row.id }).open();
|
||||
}
|
||||
|
||||
const expandAll = () => {
|
||||
gridApi.grid?.setAllTreeExpand(true);
|
||||
};
|
||||
const collapseAll = () => {
|
||||
gridApi.grid?.setAllTreeExpand(false);
|
||||
};
|
||||
function onDelete(row: SystemMenuApi.SystemMenu) {
|
||||
const hideLoading = message.loading({
|
||||
content: $t('ui.actionMessage.deleting', [row.name]),
|
||||
@@ -115,6 +120,12 @@ function onDelete(row: SystemMenuApi.SystemMenu) {
|
||||
<FormDrawer @success="onRefresh" />
|
||||
<Grid>
|
||||
<template #toolbar-tools>
|
||||
<Button class="mr-2" type="primary" @click="expandAll">
|
||||
展开全部
|
||||
</Button>
|
||||
<Button class="mr-2" type="primary" @click="collapseAll">
|
||||
折叠全部
|
||||
</Button>
|
||||
<Button
|
||||
type="primary"
|
||||
@click="onCreate"
|
||||
|
||||
Reference in New Issue
Block a user