Add: Docker build

This commit is contained in:
2025-06-02 23:31:11 +08:00
parent 51ba0cbaed
commit d5e491de52
+1 -1
View File
@@ -5,12 +5,12 @@ WORKDIR /usr/src/app
ENV RUSTFLAGS="-C target-feature=+crt-static" ENV RUSTFLAGS="-C target-feature=+crt-static"
COPY Cargo.toml Cargo.lock ./ COPY Cargo.toml Cargo.lock ./
COPY src ./src
RUN --mount=type=cache,target=/usr/local/cargo/registry \ RUN --mount=type=cache,target=/usr/local/cargo/registry \
--mount=type=cache,target=/usr/local/cargo/git \ --mount=type=cache,target=/usr/local/cargo/git \
rustup target add x86_64-unknown-linux-musl \ rustup target add x86_64-unknown-linux-musl \
&& cargo fetch --locked --target x86_64-unknown-linux-musl && cargo fetch --locked --target x86_64-unknown-linux-musl
COPY src ./src
RUN --mount=type=cache,target=/usr/local/cargo/registry \ RUN --mount=type=cache,target=/usr/local/cargo/registry \
--mount=type=cache,target=/usr/local/cargo/git \ --mount=type=cache,target=/usr/local/cargo/git \
cargo build --release --target x86_64-unknown-linux-musl cargo build --release --target x86_64-unknown-linux-musl