-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile
60 lines (52 loc) · 1.58 KB
/
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
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
55
56
57
58
59
60
# ------------------- #
# -- Oghma Planner -- #
# ------------------- #
FROM lukemathwalker/cargo-chef:latest-rust-1.63 as planner
WORKDIR /data/oghma
COPY . .
RUN cargo chef prepare --recipe-path recipe.json
# ------------------- #
# -- Oghma Cacher -- #
# ------------------- #
FROM lukemathwalker/cargo-chef:latest-rust-1.63 as cacher
WORKDIR /data/oghma
COPY --from=planner /data/oghma/recipe.json recipe.json
RUN rustup target add x86_64-unknown-linux-gnu
RUN cargo chef cook --release --target x86_64-unknown-linux-gnu --recipe-path recipe.json
# ------------------- #
# -- Oghma Builder -- #
# ------------------- #
FROM rust:1.84 as builder
WORKDIR /data/oghma
COPY . .
# Copy over the cached dependencies
COPY --from=cacher /data/oghma/target target
COPY --from=cacher /usr/local/cargo/registry /usr/local/cargo/
RUN cargo build --release
# ------------------- #
# -- Oghma Runtime -- #
# ------------------- #
FROM debian:11-slim as runtime
WORKDIR /apps
COPY --from=builder /data/oghma/target/x86_64-unknown-linux-gnu/release/oghma-bot /data/oghma/target/release/oghma-bot ./
ENTRYPOINT ["/apps/oghma-bot"]
#CMD ["--version"]
#FROM rust:1.63.0-bullseye AS builder
#
### Install target platform (Cross-Compilation) --> Needed for Alpine
#RUN rustup target add x86_64-unknown-linux-gnu
#
#WORKDIR /app
#
#COPY . .
#
## This is a dummy build to get the dependencies cached.
#RUN cargo build --target x86_64-unknown-linux-gnu --release
#
#FROM debian:bullseye
#
#WORKDIR /bot
#
#COPY --from=builder /app/target/x86_64-unknown-linux-gnu/release/oghma-bot /bot/oghma-bot
#
#ENTRYPOINT [ "/bot/oghma-bot" ]