From f19bd6e52e402ac329484402cfd309a6c54d96d5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=88=98=E8=88=AA=E5=AE=87?= <3364451258@qq.com> Date: Thu, 18 Jun 2026 12:23:28 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20Docker=20=E9=95=9C=E5=83=8F=E6=9E=84?= =?UTF-8?q?=E5=BB=BA=E6=88=90=E5=8A=9F=20=E2=80=94=2017.7MB=20alpine=20?= =?UTF-8?q?=E9=95=9C=E5=83=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - .dockerignore: 排除 target/ gui/ test/ (镜像上下文 ~3KB) - web/Dockerfile: sed 移除 gui 成员后编译,避免 Tauri 依赖 - 多阶段构建: rust:alpine 编译 → alpine:3.22 运行 Co-Authored-By: Claude --- .dockerignore | 7 +++++++ web/Dockerfile | 2 ++ 2 files changed, 9 insertions(+) create mode 100644 .dockerignore diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..ab50e74 --- /dev/null +++ b/.dockerignore @@ -0,0 +1,7 @@ +target/ +gui/ +test/ +*.png +*.svg +.git/ +.gitignore diff --git a/web/Dockerfile b/web/Dockerfile index 97233bf..b4a4bcc 100644 --- a/web/Dockerfile +++ b/web/Dockerfile @@ -4,6 +4,8 @@ FROM rust:1.95-alpine AS builder RUN apk add --no-cache musl-dev WORKDIR /app COPY . . +# 移除 gui 成员(不需要 Tauri/WebView2 依赖) +RUN sed -i 's/"core", "cli", "gui", "web"/"core", "cli", "web"/' Cargo.toml RUN cargo build --release -p qrgen-web # ── 运行阶段 ──