AT-based link agregator. Mirror of https://github.com/likeandscribe/frontpage

Update to rust 1.89, use cargo chef

tom.sherman.is e610986e 1b108d87

verified
+17 -14
+17 -14
packages-rs/drainpipe/Dockerfile
··· 1 - FROM rust:1.78-alpine AS builder 1 + FROM rust:1.89-alpine AS chef 2 + RUN apk add libressl-dev musl-dev sqlite-dev 3 + RUN cargo install cargo-chef 2 4 3 - # TODO: Figure out what we need to change here! 5 + WORKDIR /app 6 + FROM chef AS planner 7 + # Assumes . is root of monorepo, so build context should be set accordingly 8 + COPY . . 9 + RUN cargo chef prepare --recipe-path recipe.json 4 10 5 - RUN apk add libressl-dev musl-dev sqlite-dev 6 - 7 - WORKDIR /usr/src/unravel 11 + FROM chef AS builder 12 + COPY --from=planner /app/recipe.json recipe.json 13 + # Build dependencies - this is the caching Docker layer! 14 + RUN cargo chef cook --release --recipe-path recipe.json 15 + # Build application. Again, assumes . is root of monorepo. 8 16 COPY . . 9 - # TODO: Use cargo-chef to cache dependencies compilation independently of the binary 10 - RUN --mount=type=cache,target=/usr/local/cargo/registry \ 11 - --mount=type=cache,target=/root/target \ 12 - cargo build --release --package drainpipe && \ 13 - # Move the release binary to a folder to be copied to the final image. It can't be copied directly from the target folder because it's in a cache mount 14 - # See https://gist.github.com/noelbundick/6922d26667616e2ba5c3aff59f0824cd?permalink_comment_id=4379948#gistcomment-4379948 15 - mv ./target/release /root 17 + RUN cargo build --release --bin drainpipe 16 18 17 19 FROM alpine:3.14 18 - COPY --from=builder /root/release/drainpipe / 20 + WORKDIR /app 21 + COPY --from=builder /app/target/release/drainpipe /usr/local/drainpipe 19 22 20 23 ENV STORE_LOCATION="/drainpipedata/sled" 21 24 22 - ENTRYPOINT ["/drainpipe"] 25 + ENTRYPOINT ["/usr/local/drainpipe"]