feat: add node env build
This commit is contained in:
+2
-1
@@ -50,7 +50,8 @@ RUN CGO_ENABLED=0 GOOS=${TARGETOS} GOARCH=${TARGETARCH} \
|
||||
FROM debian:bookworm-slim
|
||||
|
||||
ENV TZ=Asia/Shanghai
|
||||
ENV PATH="/app/envs/python/bin:$PATH"
|
||||
ENV PATH="/app/envs/node/bin:/app/envs/python/bin:$PATH"
|
||||
ENV NODE_PATH="/app/envs/node/lib/node_modules"
|
||||
|
||||
# 安装必要系统工具 + Node + Python
|
||||
RUN sed -i 's@deb.debian.org@mirrors.tuna.tsinghua.edu.cn@g' /etc/apt/sources.list.d/debian.sources \
|
||||
|
||||
+19
-2
@@ -1,6 +1,7 @@
|
||||
#!/bin/sh
|
||||
|
||||
PYTHON_VENV_DIR="/app/envs/python"
|
||||
NODE_ENV_DIR="/app/envs/node"
|
||||
|
||||
# ============================
|
||||
# 创建必要目录
|
||||
@@ -21,9 +22,25 @@ else
|
||||
fi
|
||||
|
||||
# ============================
|
||||
# 激活 Python 虚拟环境
|
||||
# 创建 Node 环境目录(如果不存在)
|
||||
# ============================
|
||||
export PATH="$PYTHON_VENV_DIR/bin:$PATH"
|
||||
if [ ! -d "$NODE_ENV_DIR" ]; then
|
||||
echo "Creating Node environment directory..."
|
||||
mkdir -p "$NODE_ENV_DIR"
|
||||
# 设置 npm 全局安装目录
|
||||
npm config set prefix "$NODE_ENV_DIR"
|
||||
# 配置淘宝镜像
|
||||
npm config set registry https://registry.npmmirror.com
|
||||
echo "Node environment created at $NODE_ENV_DIR"
|
||||
else
|
||||
echo "Node environment already exists at $NODE_ENV_DIR"
|
||||
fi
|
||||
|
||||
# ============================
|
||||
# 设置环境变量
|
||||
# ============================
|
||||
export PATH="$NODE_ENV_DIR/bin:$PYTHON_VENV_DIR/bin:$PATH"
|
||||
export NODE_PATH="$NODE_ENV_DIR/lib/node_modules"
|
||||
|
||||
# ============================
|
||||
# 启动应用
|
||||
|
||||
@@ -2,7 +2,6 @@
|
||||
import { ref, onMounted } from 'vue'
|
||||
import { Button } from '@/components/ui/button'
|
||||
import { Input } from '@/components/ui/input'
|
||||
import { Badge } from '@/components/ui/badge'
|
||||
import Pagination from '@/components/Pagination.vue'
|
||||
import { RefreshCw, Search } from 'lucide-vue-next'
|
||||
import { api } from '@/api'
|
||||
@@ -106,9 +105,7 @@ onMounted(loadLogs)
|
||||
<span class="w-24 shrink-0 font-medium text-sm truncate">{{ log.username }}</span>
|
||||
<code class="w-32 shrink-0 text-xs text-muted-foreground bg-muted px-2 py-1 rounded">{{ log.ip }}</code>
|
||||
<span class="w-16 shrink-0 flex justify-center">
|
||||
<Badge :variant="log.status === 'success' ? 'default' : 'destructive'" class="text-xs">
|
||||
{{ log.status === 'success' ? '成功' : '失败' }}
|
||||
</Badge>
|
||||
<span :class="['h-2 w-2 rounded-full', log.status === 'success' ? 'bg-green-500' : 'bg-red-500']"></span>
|
||||
</span>
|
||||
<span class="flex-1 text-xs text-muted-foreground truncate" :title="log.user_agent">{{ log.user_agent || '-' }}</span>
|
||||
<span class="w-40 shrink-0 text-right text-xs text-muted-foreground">{{ log.created_at }}</span>
|
||||
|
||||
Reference in New Issue
Block a user