# Stage 1: Build the Rust application FROM rust:1.86-slim AS builder WORKDIR /app # Install build dependencies RUN apt-get update && \ apt-get install -y pkg-config libssl-dev && \ apt-get clean && \ rm -rf /var/lib/apt/lists/* # Copy the actual source code and build the application COPY . . RUN cargo build --release # Stage 2: Create the runtime image FROM debian:bookworm-slim # Install runtime dependencies RUN apt-get update && \ apt-get install -y --no-install-recommends ca-certificates tini tzdata && \ cp /usr/share/zoneinfo/Asia/Shanghai /etc/localtime && \ echo "Asia/Shanghai" > /etc/timezone && \ apt-get remove -y tzdata && \ apt-get autoremove -y && \ apt-get clean && \ rm -rf /var/lib/apt/lists/* WORKDIR /root/ # Copy the binary from builder stage COPY --from=builder /app/target/release/aliyundrive-webdav-oauth /usr/bin/aliyundrive-webdav-oauth CMD ["/usr/bin/aliyundrive-webdav-oauth"]