natter/docker/natter/Dockerfile
Tom Alexander 4a76f61aa7
All checks were successful
clippy Build clippy has succeeded
format Build format has succeeded
rust-test Build rust-test has succeeded
Update dockerfiles to take advantage of BuildKit.
2024-10-20 21:50:16 -04:00

16 lines
542 B
Docker

ARG ALPINE_VERSION="3.20"
FROM rustlang/rust:nightly-alpine$ALPINE_VERSION AS builder
RUN apk add --no-cache musl-dev
RUN mkdir /root/natter
WORKDIR /root/natter
COPY . .
# TODO: Add static build, which currently errors due to proc_macro. RUSTFLAGS="-C target-feature=+crt-static"
RUN --mount=type=tmpfs,target=/tmp --mount=type=cache,target=/usr/local/cargo/registry,sharing=locked CARGO_TARGET_DIR=/target cargo build --profile release-lto
FROM alpine:$ALPINE_VERSION AS runner
COPY --from=builder /target/release-lto/natter /usr/bin/