部署牧安云哨

This commit is contained in:
BBIT-Kai
2025-12-31 17:49:55 +08:00
parent 6136554562
commit 7b669ffbd0
5 changed files with 68 additions and 17 deletions
+50
View File
@@ -0,0 +1,50 @@
# 使用官方 Python 镜像
FROM python:3.10-slim
WORKDIR /app
RUN apt-get update && \
apt-get install -y --no-install-recommends \
libpq5 \
unixodbc \
curl \
fonts-wqy-zenhei \
libgl1 \
gnupg \
apt-transport-https \
lsb-release && \
# 导入微软 GPG key(使用 keyrings 方式)
curl https://packages.microsoft.com/keys/microsoft.asc | gpg --dearmor > /usr/share/keyrings/microsoft.gpg && \
echo "deb [arch=amd64 signed-by=/usr/share/keyrings/microsoft.gpg] https://packages.microsoft.com/ubuntu/22.04/prod jammy main" > /etc/apt/sources.list.d/mssql-release.list && \
apt-get update && \
ACCEPT_EULA=Y apt-get install -y msodbcsql18 && \
rm -rf /var/lib/apt/lists/*
COPY app/requirements.txt .
# 安装 Python 依赖
RUN pip install --no-cache-dir -i https://pypi.tuna.tsinghua.edu.cn/simple -r requirements.txt
RUN python -m pip uninstall -y opencv-python
RUN python -m pip install opencv-python-headless
# 复制并解压 JRE
COPY docker/OpenJDK17U-jre_x64_linux_hotspot_17.0.16_8.tar.gz /opt/
RUN tar -xzf /opt/OpenJDK17U-jre_x64_linux_hotspot_17.0.16_8.tar.gz -C /opt/ && \
rm /opt/OpenJDK17U-jre_x64_linux_hotspot_17.0.16_8.tar.gz
# 配置 Java 环境
ENV JAVA_HOME=/opt/jdk-17.0.16+8-jre
ENV PATH="$JAVA_HOME/bin:$PATH"
# 复制项目代码
COPY app/ .
# 复制 pyzxing 的 jar 文件到默认路径
COPY docker/javase-3.4.1-SNAPSHOT-jar-with-dependencies.jar /root/.local/pyzxing/javase-3.4.1-SNAPSHOT-jar-with-dependencies.jar
EXPOSE 13011
# 启动命令(使用 uvicorn 启动 FastAPI
CMD ["python", "app.py"]
+3 -3
View File
@@ -23,8 +23,8 @@ func main() {
fmt.Println(banner)
deviceID := device.GetDeviceID()
log.Init(config.Log_file_dic) // 初始化日志目录
log.Info("Device id: " + deviceID) // 第一次启动记录
log.Init(config.Log_file_dic) // 初始化日志目录
log.Info("Device id: " + deviceID) // 第一次启动记录
log.Println("版本号: ", config.APP_VERSION) // 第一次启动记录
var mqttSvc *MQTTService
@@ -55,7 +55,7 @@ func main() {
continue
}
// 个人业务
//test()
test()
break
}
+11 -11
View File
@@ -170,13 +170,13 @@ export function useColumns<T = SystemUserApi.SystemUser>(
field: 'online',
slots: { default: 'status' },
title: '当前状态',
width: 100,
width: 80,
},
{
field: 'device_type',
slots: { default: 'deviceType' },
title: '设备类型',
width: 100,
width: 80,
},
{
field: 'dept_name',
@@ -192,15 +192,6 @@ export function useColumns<T = SystemUserApi.SystemUser>(
title: '可用性',
width: 100,
},
{
cellRender: {
attrs: { beforeChange: onIsSuperUserChange },
name: onIsSuperUserChange ? 'CellSwitch' : 'CellTag',
},
field: 'is_superuser',
title: '管理员',
width: 100,
},
{
field: 'remark',
title: '备注',
@@ -256,6 +247,15 @@ export function useColumns<T = SystemUserApi.SystemUser>(
title: '创建时间',
width: 150,
},
{
cellRender: {
attrs: { beforeChange: onIsSuperUserChange },
name: onIsSuperUserChange ? 'CellSwitch' : 'CellTag',
},
field: 'is_superuser',
title: '管理员',
width: 100,
},
{
field: 'operation',
title: '操作',
@@ -202,8 +202,8 @@ let ws: null | WebSocket = null;
function createWs(token: string) {
ws = new WebSocket(
// `wss://ai.ronsunny.cn:8090/ai/iot/ws/device-status?token=${token}`,
`ws://127.0.0.1:13011/iot/ws/device-status?token=${token}`,
`wss://ai.ronsunny.cn:8090/ai/iot/ws/device-status?token=${token}`,
// `ws://127.0.0.1:13011/iot/ws/device-status?token=${token}`,
);
wsState.ws = ws;
@@ -172,7 +172,8 @@ function createWs(token: string) {
}
ws = new WebSocket(
`ws://127.0.0.1:13011/iot/ws/sentinel_record?token=${token}`,
// `ws://127.0.0.1:13011/iot/ws/sentinel_record?token=${token}`,
`wss://ai.ronsunny.cn:8090/ai/iot/ws/sentinel_record?token=${token}`,
);
ws.onmessage = (e) => {