6ba79a99d3
新增 workspace crate : - axum 0.8 + tokio 异步 HTTP 服务 - / → 嵌入式 HTML 页面(输入→实时预览→下载/复制) - /api/qr?text=&level=M&margin=4&size=8 → PNG - Dockerfile: rust-alpine 多阶段构建,镜像仅 ~12MB - Cargo.toml: workspace 新增 web 成员 部署: docker build -t qrgen-web -f web/Dockerfile . docker run -p 3000:3000 qrgen-web Co-Authored-By: Claude <noreply@anthropic.com>
19 lines
362 B
Docker
19 lines
362 B
Docker
# ── 构建阶段 ──
|
|
FROM rust:1.95-alpine AS builder
|
|
|
|
RUN apk add --no-cache musl-dev
|
|
WORKDIR /app
|
|
COPY . .
|
|
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"]
|