tricot/Dockerfile
fred ea6287ad39
All checks were successful
ci/woodpecker/pr/woodpecker Pipeline was successful
optimised Dockerfile in a alpine image
2024-12-05 01:12:29 +01:00

28 lines
704 B
Docker

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
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
CMD ["/usr/local/bin/tricot"]