2024-12-05 00:12:29 +00:00
|
|
|
FROM rust:alpine AS builder
|
|
|
|
RUN apk add --no-cache openssl-dev musl-dev
|
|
|
|
RUN rustup target add x86_64-unknown-linux-musl
|
2021-12-08 11:02:39 +00:00
|
|
|
|
|
|
|
WORKDIR /srv
|
|
|
|
|
|
|
|
# Build dependencies and cache them
|
|
|
|
COPY Cargo.* ./
|
|
|
|
|
|
|
|
# Build final app
|
|
|
|
COPY ./src ./src
|
2024-12-05 00:12:29 +00:00
|
|
|
RUN RUSTFLAGS=-Ctarget-feature=-crt-static \
|
|
|
|
cargo build \
|
|
|
|
--release \
|
|
|
|
--target=x86_64-unknown-linux-musl
|
|
|
|
|
|
|
|
RUN objcopy \
|
|
|
|
--compress-debug-sections \
|
|
|
|
target/x86_64-unknown-linux-musl/release/tricot \
|
|
|
|
target/x86_64-unknown-linux-musl/release/tricot.compressed
|
|
|
|
|
|
|
|
FROM alpine
|
|
|
|
RUN apk add -U --no-cache ca-certificates libgcc
|
|
|
|
COPY --from=builder \
|
|
|
|
/srv/target/x86_64-unknown-linux-musl/release/tricot.compressed \
|
|
|
|
/usr/local/bin/tricot
|
2021-12-08 11:02:39 +00:00
|
|
|
|
2024-12-05 00:12:29 +00:00
|
|
|
CMD ["/usr/local/bin/tricot"]
|