tricot/Dockerfile

29 lines
704 B
Text
Raw Normal View History

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
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
2024-12-05 00:12:29 +00:00
CMD ["/usr/local/bin/tricot"]