mirror of
https://github.com/minoplhy/chhoto-url.git
synced 2024-11-22 01:06:46 +00:00
build: Switch to a static build to mitigate incompatible packages
This commit is contained in:
parent
583700cdbf
commit
caa6c58fd2
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 new --bin simply-shorten
|
||||
WORKDIR /simply-shorten
|
||||
|
||||
RUN rustup target add x86_64-unknown-linux-musl
|
||||
|
||||
COPY ./actix/Cargo.toml .
|
||||
COPY ./actix/Cargo.lock .
|
||||
|
||||
RUN cargo build-deps --release
|
||||
RUN cargo build-deps --release --target=x86_64-unknown-linux-musl
|
||||
|
||||
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
|
||||
|
||||
COPY --from=build /simply-shorten/target/release/simply-shorten /opt/simply-shorten
|
||||
COPY ./actix/resources /opt/resources
|
||||
|
||||
CMD ["./simply-shorten"]
|
||||
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"
|
||||
checksum = "cf4e226dcd58b4be396f7bd3c20da8fdee2911400705297ba7d2d7cc2c30f716"
|
||||
dependencies = [
|
||||
"cc",
|
||||
"pkg-config",
|
||||
"vcpkg",
|
||||
]
|
||||
|
@ -26,7 +26,7 @@ categories = ["web-programming"]
|
||||
[dependencies]
|
||||
actix-web = "4.5.1"
|
||||
actix-files = "0.6.5"
|
||||
rusqlite = "0.30.0"
|
||||
rusqlite = { version = "0.30.0", features = ["bundled"] }
|
||||
regex = "1.10.3"
|
||||
rand = "0.8.5"
|
||||
actix-session = { version = "0.9.0", features = ["cookie-session"] }
|
||||
|
Loading…
Reference in New Issue
Block a user