mirror of
https://github.com/SinTan1729/chhoto-url
synced 2024-12-26 23:58:35 -06:00
build: Switch to a static build to mitigate incompatible packages
This commit is contained in:
parent
583700cdbf
commit
caa6c58fd2
3 changed files with 16 additions and 12 deletions
25
Dockerfile
25
Dockerfile
|
@ -1,25 +1,28 @@
|
||||||
FROM rust:1 as build
|
FROM rust:slim AS build
|
||||||
|
ENV TARGET x86_64-unknown-linux-musl
|
||||||
|
|
||||||
|
RUN apt-get update && apt-get install -y musl-tools
|
||||||
|
RUN rustup target add "$TARGET"
|
||||||
|
|
||||||
RUN cargo install cargo-build-deps
|
RUN cargo install cargo-build-deps
|
||||||
|
|
||||||
RUN cargo new --bin simply-shorten
|
RUN cargo new --bin simply-shorten
|
||||||
WORKDIR /simply-shorten
|
WORKDIR /simply-shorten
|
||||||
|
|
||||||
|
RUN rustup target add x86_64-unknown-linux-musl
|
||||||
|
|
||||||
COPY ./actix/Cargo.toml .
|
COPY ./actix/Cargo.toml .
|
||||||
COPY ./actix/Cargo.lock .
|
COPY ./actix/Cargo.lock .
|
||||||
|
|
||||||
RUN cargo build-deps --release
|
RUN cargo build-deps --release --target=x86_64-unknown-linux-musl
|
||||||
|
|
||||||
COPY ./actix/src ./src
|
COPY ./actix/src ./src
|
||||||
|
|
||||||
RUN cargo build --release
|
RUN cargo build --release --locked --target "$TARGET"
|
||||||
|
|
||||||
FROM frolvlad/alpine-glibc:latest
|
FROM scratch
|
||||||
|
|
||||||
RUN apk add sqlite-libs
|
COPY --from=build /simply-shorten/target/x86_64-unknown-linux-musl/release/simply-shorten /simply-shorten
|
||||||
|
COPY ./actix/resources /resources
|
||||||
|
|
||||||
WORKDIR /opt
|
CMD ["/simply-shorten"]
|
||||||
|
|
||||||
COPY --from=build /simply-shorten/target/release/simply-shorten /opt/simply-shorten
|
|
||||||
COPY ./actix/resources /opt/resources
|
|
||||||
|
|
||||||
CMD ["./simply-shorten"]
|
|
||||||
|
|
1
actix/Cargo.lock
generated
1
actix/Cargo.lock
generated
|
@ -858,6 +858,7 @@ version = "0.27.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "cf4e226dcd58b4be396f7bd3c20da8fdee2911400705297ba7d2d7cc2c30f716"
|
checksum = "cf4e226dcd58b4be396f7bd3c20da8fdee2911400705297ba7d2d7cc2c30f716"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
|
"cc",
|
||||||
"pkg-config",
|
"pkg-config",
|
||||||
"vcpkg",
|
"vcpkg",
|
||||||
]
|
]
|
||||||
|
|
|
@ -26,7 +26,7 @@ categories = ["web-programming"]
|
||||||
[dependencies]
|
[dependencies]
|
||||||
actix-web = "4.5.1"
|
actix-web = "4.5.1"
|
||||||
actix-files = "0.6.5"
|
actix-files = "0.6.5"
|
||||||
rusqlite = "0.30.0"
|
rusqlite = { version = "0.30.0", features = ["bundled"] }
|
||||||
regex = "1.10.3"
|
regex = "1.10.3"
|
||||||
rand = "0.8.5"
|
rand = "0.8.5"
|
||||||
actix-session = { version = "0.9.0", features = ["cookie-session"] }
|
actix-session = { version = "0.9.0", features = ["cookie-session"] }
|
||||||
|
|
Loading…
Reference in a new issue