-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
27 lines (24 loc) · 1002 Bytes
/
Copy pathDockerfile
File metadata and controls
27 lines (24 loc) · 1002 Bytes
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 rust:latest AS base
RUN cargo install sccache
RUN cargo install cargo-chef
ENV RUSTC_WRAPPER=sccache SCCACHE_DIR=/sccache
FROM base AS planner
WORKDIR /telegram-bot-api-proxy
COPY . .
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
WORKDIR /telegram-bot-api-proxy
COPY --from=planner /telegram-bot-api-proxy/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 . .
RUN --mount=type=cache,target=/usr/local/cargo/registry \
--mount=type=cache,target=$SCCACHE_DIR,sharing=locked \
cargo build --release
FROM base AS runner
WORKDIR /telegram-bot-api-proxy
COPY --from=builder /telegram-bot-api-proxy/target/release/telegram-bot-api-proxy /bin/telegram-bot-api-proxy
CMD [ "telegram-bot-api-proxy" ]