Skip to content

Open-source LLM knowledge platform: turn raw documents into a queryable RAG, an autonomous reasoning agent, and a self-maintaining Wiki.

fix(docker): 修复镜像构建兼容性问题

Liwxda8191cd576e
diff --git a/.gitignore b/.gitignore
index bae931dc8..2808f3120 100644
--- a/.gitignore
+++ b/.gitignore
@@ -45,4 +45,9 @@ web/
/server
frontend/.vite
frontend/chrome-extension/
-WeKnora-Chrome-Extension
\ No newline at end of file
+WeKnora-Chrome-Extension
+packages/protoc-3.19.4-linux-x86_64.zip
+
+# 本地测试脚本
+configure-ollama.sh
+fix-docker.sh
\ No newline at end of file
diff --git a/docker/Dockerfile.app b/docker/Dockerfile.app
index d681cd670..fac4022a6 100644
--- a/docker/Dockerfile.app
+++ b/docker/Dockerfile.app
@@ -57,12 +57,18 @@ ARG APK_MIRROR_ARG
# Create a non-root user first
RUN useradd -m -s /bin/bash appuser
+# First, install ca-certificates without mirror to ensure HTTPS works
+RUN apt-get update && \
+ apt-get install -y --no-install-recommends ca-certificates && \
+ rm -rf /var/lib/apt/lists/*
+
+# Then switch to mirror if specified and install other packages
RUN if [ -n "$APK_MIRROR_ARG" ]; then \
sed -i "[email protected]@${APK_MIRROR_ARG}@g" /etc/apt/sources.list.d/debian.sources; \
fi && \
apt-get update && \
apt-get install -y --no-install-recommends \
- build-essential postgresql-client default-mysql-client ca-certificates tzdata sed curl bash vim wget \
+ build-essential postgresql-client default-mysql-client tzdata sed curl bash vim wget \
libsqlite3-0 \
python3 python3-pip python3-dev libffi-dev libssl-dev \
nodejs npm \
diff --git a/docker/Dockerfile.docreader b/docker/Dockerfile.docreader
index cfefb245e..c60f7721b 100644
--- a/docker/Dockerfile.docreader
+++ b/docker/Dockerfile.docreader
@@ -29,12 +29,23 @@ RUN apt-get update && apt-get install -y \
# 检查是否存在本地protoc安装包,如果存在则离线安装,否则在线安装
ARG TARGETARCH
COPY packages/ /app/packages/
-RUN echo "检查本地protoc安装包..." && \
- case ${TARGETARCH} in \
+# 兼容 BuildKit 和传统构建:如果 TARGETARCH 为空,使用 uname 检测
+RUN if [ -z "$TARGETARCH" ]; then \
+ case $(uname -m) in \
+ "x86_64") TARGETARCH="amd64" ;; \
+ "aarch64") TARGETARCH="arm64" ;; \
+ "armv7l") TARGETARCH="arm" ;; \
+ *) echo "Unsupported architecture: $(uname -m)" && exit 1 ;; \
+ esac; \
+ echo "[自动检测] 架构: $TARGETARCH"; \
+ else \
+ echo "[BuildKit] 架构: $TARGETARCH"; \
+ fi && \
+ case $TARGETARCH in \
"amd64") PROTOC_ARCH="x86_64" ;; \
"arm64") PROTOC_ARCH="aarch_64" ;; \
"arm") PROTOC_ARCH="arm" ;; \
- *) echo "Unsupported architecture for protoc: ${TARGETARCH}" && exit 1 ;; \
+ *) echo "Unsupported architecture for protoc: $TARGETARCH" && exit 1 ;; \
esac && \
PROTOC_PACKAGE="protoc-3.19.4-linux-${PROTOC_ARCH}.zip" && \
if [ -f "/app/packages/${PROTOC_PACKAGE}" ]; then \
@@ -100,12 +111,24 @@ RUN apt-get update && apt-get install -y \
# 安装 grpc_health_probe
ARG TARGETARCH
-RUN GRPC_HEALTH_PROBE_VERSION=v0.4.24 && \
- case ${TARGETARCH} in \
+# 兼容 BuildKit 和传统构建:如果 TARGETARCH 为空,使用 uname 检测
+RUN if [ -z "$TARGETARCH" ]; then \
+ case $(uname -m) in \
+ "x86_64") TARGETARCH="amd64" ;; \
+ "aarch64") TARGETARCH="arm64" ;; \
+ "armv7l") TARGETARCH="arm" ;; \
+ *) echo "Unsupported architecture: $(uname -m)" && exit 1 ;; \
+ esac; \
+ echo "[自动检测] 架构: $TARGETARCH"; \
+ else \
+ echo "[BuildKit] 架构: $TARGETARCH"; \
+ fi && \
+ GRPC_HEALTH_PROBE_VERSION=v0.4.24 && \
+ case $TARGETARCH in \
"amd64") ARCH="amd64" ;; \
"arm64") ARCH="arm64" ;; \
"arm") ARCH="arm" ;; \
- *) echo "Unsupported architecture: ${TARGETARCH}" && exit 1 ;; \
+ *) echo "Unsupported architecture: $TARGETARCH" && exit 1 ;; \
esac && \
wget -qO/bin/grpc_health_probe https://github.com/grpc-ecosystem/grpc-health-probe/releases/download/${GRPC_HEALTH_PROBE_VERSION}/grpc_health_probe-linux-${ARCH} && \
chmod +x /bin/grpc_health_probe