-
Notifications
You must be signed in to change notification settings - Fork 1
/
Dockerfile
27 lines (24 loc) · 973 Bytes
/
Dockerfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
FROM lukemathwalker/cargo-chef:latest-rust-alpine AS base
RUN apk add musl-dev sccache
ENV RUSTC_WRAPPER=sccache SCCACHE_DIR=/sccache
WORKDIR /app
FROM base AS planner
COPY src /app/src
COPY Cargo.toml Cargo.lock config.base.yaml /app/
RUN --mount=type=cache,target=/usr/local/cargo/registry \
--mount=type=cache,target=$SCCACHE_DIR,sharing=locked \
cargo chef prepare --recipe-path recipe.json
FROM base AS builder
COPY --from=planner /app/recipe.json recipe.json
RUN --mount=type=cache,target=/usr/local/cargo/registry \
--mount=type=cache,target=$SCCACHE_DIR,sharing=locked \
cargo chef cook --release --recipe-path recipe.json
COPY src /app/src
COPY Cargo.toml Cargo.lock config.base.yaml /app/
RUN --mount=type=cache,target=/usr/local/cargo/registry \
--mount=type=cache,target=$SCCACHE_DIR,sharing=locked \
cargo build --release --bin oracles
FROM alpine
WORKDIR /app
COPY --from=builder /app/target/release/oracles /app/
CMD ["./oracles"]