Compare commits

...

1 Commits

Author SHA1 Message Date
sugarBecomer 36a6932056 🐛 opencv 2025-11-12 15:19:15 +08:00
+23 -5
View File
@@ -20,13 +20,23 @@ RUN apt install -y upx-ucl
RUN upx --best --lzma bin/server
# 收集所有 OpenCV 运行时需要的 .so 文件
RUN mkdir -p /opencv-libs && \
cp -P /usr/lib/x86_64-linux-gnu/libopencv*.so* /opencv-libs/ 2>/dev/null || true
# 使用 ldd 检查二进制文件的依赖,并收集所有需要的 .so 文件
RUN mkdir -p /opencv-libs /qt-libs /other-libs && \
cp -P /usr/lib/x86_64-linux-gnu/libopencv*.so* /opencv-libs/ 2>/dev/null || true && \
cp -P /usr/lib/x86_64-linux-gnu/libQt5*.so* /qt-libs/ 2>/dev/null || true && \
cp -P /usr/lib/x86_64-linux-gnu/libpng*.so* /other-libs/ 2>/dev/null || true && \
cp -P /usr/lib/x86_64-linux-gnu/libjpeg*.so* /other-libs/ 2>/dev/null || true && \
cp -P /usr/lib/x86_64-linux-gnu/libtiff*.so* /other-libs/ 2>/dev/null || true && \
cp -P /usr/lib/x86_64-linux-gnu/libwebp*.so* /other-libs/ 2>/dev/null || true && \
cp -P /usr/lib/x86_64-linux-gnu/libImath*.so* /other-libs/ 2>/dev/null || true && \
cp -P /usr/lib/x86_64-linux-gnu/libIlmImf*.so* /other-libs/ 2>/dev/null || true && \
cp -P /usr/lib/x86_64-linux-gnu/libIex*.so* /other-libs/ 2>/dev/null || true && \
cp -P /usr/lib/x86_64-linux-gnu/libHalf*.so* /other-libs/ 2>/dev/null || true && \
cp -P /usr/lib/x86_64-linux-gnu/libIlmThread*.so* /other-libs/ 2>/dev/null || true
FROM golang:latest
# 安装 OpenCV 运行时依赖
# 安装 OpenCV 和 Qt 运行时依赖
RUN apt update && apt install -y \
libgl1 \
libglvnd0 \
@@ -34,10 +44,18 @@ RUN apt update && apt install -y \
libgomp1 \
libglib2.0-0 \
libglx0 \
libqt5core5a \
libqt5gui5 \
libqt5widgets5 \
libqt5test5 \
libdouble-conversion3 \
libxcb-xinerama0 \
&& rm -rf /var/lib/apt/lists/*
# 复制 OpenCV .so 文件到运行环境
# 复制所有 .so 文件到运行环境
COPY --from=backend-builder /opencv-libs/* /usr/lib/x86_64-linux-gnu/
COPY --from=backend-builder /qt-libs/* /usr/lib/x86_64-linux-gnu/
COPY --from=backend-builder /other-libs/* /usr/lib/x86_64-linux-gnu/
COPY --from=backend-builder /build/bin/server /app/server
#COPY static /app/static