mirror of
https://github.com/Tencent/WeKnora.git
synced 2026-06-04 13:30:32 +08:00
feat: enhance Dockerfile and build scripts for customizable APT mirror
- Added support for customizable APT mirror in the Dockerfile for the docreader service, allowing users to specify a mirror via build arguments. - Updated docker-compose.yml to pass the APT_MIRROR argument during the build process. - Modified build_images.sh script to include the APT_MIRROR argument when building the docreader image. - Updated .gitignore to exclude .cursor/ directory. This update improves flexibility in package management during the image build process.
This commit is contained in:
1
.gitignore
vendored
1
.gitignore
vendored
@@ -1,6 +1,7 @@
|
||||
# 忽略.env文件和其他包含敏感信息的配置文件
|
||||
.env
|
||||
.env.lite
|
||||
.cursor/
|
||||
# 但不忽略示例文件
|
||||
!.env.example
|
||||
*.pem
|
||||
|
||||
@@ -145,6 +145,8 @@ services:
|
||||
build:
|
||||
context: .
|
||||
dockerfile: docker/Dockerfile.docreader
|
||||
args:
|
||||
- APT_MIRROR=${APT_MIRROR:-}
|
||||
container_name: WeKnora-docreader
|
||||
ports:
|
||||
- "${DOCREADER_PORT:-50051}:50051"
|
||||
|
||||
@@ -3,9 +3,11 @@
|
||||
# =========================
|
||||
FROM python:3.10.18-bookworm AS builder
|
||||
|
||||
# 切换 apt 源到清华
|
||||
RUN sed -i 's@http://deb.debian.org@https://mirrors.tuna.tsinghua.edu.cn@g' /etc/apt/sources.list.d/debian.sources && \
|
||||
sed -i 's@http://security.debian.org@https://mirrors.tuna.tsinghua.edu.cn@g' /etc/apt/sources.list.d/debian.sources
|
||||
ARG APT_MIRROR=""
|
||||
RUN if [ -n "$APT_MIRROR" ]; then \
|
||||
sed -i "s@http://deb.debian.org@${APT_MIRROR}@g" /etc/apt/sources.list.d/debian.sources && \
|
||||
sed -i "s@http://security.debian.org@${APT_MIRROR}@g" /etc/apt/sources.list.d/debian.sources; \
|
||||
fi
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
@@ -67,9 +69,11 @@ RUN chmod +x docreader/scripts/generate_proto.sh && \
|
||||
# =========================
|
||||
FROM python:3.10.18-bookworm AS runner
|
||||
|
||||
# 切换 apt 源到清华
|
||||
RUN sed -i 's@http://deb.debian.org@https://mirrors.tuna.tsinghua.edu.cn@g' /etc/apt/sources.list.d/debian.sources && \
|
||||
sed -i 's@http://security.debian.org@https://mirrors.tuna.tsinghua.edu.cn@g' /etc/apt/sources.list.d/debian.sources
|
||||
ARG APT_MIRROR=""
|
||||
RUN if [ -n "$APT_MIRROR" ]; then \
|
||||
sed -i "s@http://deb.debian.org@${APT_MIRROR}@g" /etc/apt/sources.list.d/debian.sources && \
|
||||
sed -i "s@http://security.debian.org@${APT_MIRROR}@g" /etc/apt/sources.list.d/debian.sources; \
|
||||
fi
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
|
||||
@@ -10,7 +10,8 @@ export default defineConfig({
|
||||
],
|
||||
resolve: {
|
||||
alias: {
|
||||
'@': fileURLToPath(new URL('./src', import.meta.url))
|
||||
'@': fileURLToPath(new URL('./src', import.meta.url)),
|
||||
'@vue-office/pptx': '@vue-office/pptx/lib/index.js',
|
||||
},
|
||||
},
|
||||
server: {
|
||||
|
||||
@@ -165,6 +165,7 @@ build_docreader_image() {
|
||||
--platform $PLATFORM \
|
||||
--build-arg PLATFORM=$PLATFORM \
|
||||
--build-arg TARGETARCH=$TARGETARCH \
|
||||
--build-arg APT_MIRROR=${APT_MIRROR:-} \
|
||||
-f docker/Dockerfile.docreader \
|
||||
-t wechatopenai/weknora-docreader:latest \
|
||||
.
|
||||
|
||||
Reference in New Issue
Block a user