Files
QRGen/web/Dockerfile
T
Serendipity f19bd6e52e feat: Docker 镜像构建成功 — 17.7MB alpine 镜像
- .dockerignore: 排除 target/ gui/ test/ (镜像上下文 ~3KB)
- web/Dockerfile: sed 移除 gui 成员后编译,避免 Tauri 依赖
- 多阶段构建: rust:alpine 编译 → alpine:3.22 运行

Co-Authored-By: Claude <noreply@anthropic.com>
2026-06-18 12:23:28 +08:00

21 lines
495 B
Docker

# ── 构建阶段 ──
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
# ── 运行阶段 ──
FROM alpine:3.22
RUN apk add --no-cache tzdata
ENV TZ=Asia/Shanghai
COPY --from=builder /app/target/release/qrgen-web /usr/local/bin/qrgen-web
EXPOSE 3000
CMD ["qrgen-web"]