-
-
Notifications
You must be signed in to change notification settings - Fork 84
/
Copy pathDockerfile.odin
54 lines (39 loc) · 1.16 KB
/
Dockerfile.odin
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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
ARG DEBIAN_VERSION=12
ARG RUST_VERSION=1.84
FROM rust:${RUST_VERSION} AS base
RUN --mount=type=cache,target=/var/cache/apt \
--mount=type=cache,target=/var/lib/apt \
apt-get update && apt-get install -y cmake
FROM base AS chef
RUN cargo install cargo-chef
# ------------------ #
# -- Odin Planner -- #
# ------------------ #
FROM chef AS planner
WORKDIR /data/odin
COPY . .
RUN cargo chef prepare --recipe-path recipe.json
# ------------------ #
# -- Odin Cacher -- #
# ------------------ #
FROM chef AS cacher
WORKDIR /data/odin
COPY --from=planner /data/odin/recipe.json recipe.json
RUN cargo chef cook --release --recipe-path recipe.json
# ------------------ #
# -- Odin Builder -- #
# ------------------ #
FROM base AS builder
WORKDIR /data/odin
COPY . .
COPY --from=cacher /data/odin/target target
COPY --from=cacher /usr/local/cargo/registry /usr/local/cargo/
RUN make release PROFILE=production
# ------------------ #
# -- Odin Runtime -- #
# ------------------ #
FROM debian:${DEBIAN_VERSION}-slim AS runtime
WORKDIR /apps
COPY --from=builder /data/odin/target/release/odin /data/odin/target/release/huginn ./
ENTRYPOINT ["/apps/odin"]
CMD ["--version"]