-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
28 lines (23 loc) · 871 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
28
ARG IMAGE_VERSION=1.77.0
FROM rust:${IMAGE_VERSION} as base
RUN apt-get update && apt-get install -y cmake && rm -rf /var/lib/apt/lists/*
WORKDIR app
RUN cargo install cargo-chef
FROM base as planner
COPY . .
RUN cargo chef prepare --recipe-path recipe.json
FROM base as cacher
COPY --from=planner /app/recipe.json recipe.json
RUN cargo chef cook --release --recipe-path recipe.json
FROM base as builder
COPY . .
# Copy over the cached dependencies
COPY --from=cacher /app/target target
COPY --from=cacher /usr/local/cargo /usr/local/cargo
RUN cargo build --release --bin rust-discord-record
FROM ubuntu:22.04 as runtime
RUN apt-get update && apt-get install -y ca-certificates && rm -rf /var/lib/apt/lists/*
WORKDIR app
COPY --from=builder /app/target/release/rust-discord-record /usr/local/bin
ENV DISCORD_TOKEN=""
ENTRYPOINT ["/usr/local/bin/rust-discord-record"]