-
Notifications
You must be signed in to change notification settings - Fork 90
/
Dockerfile
49 lines (29 loc) · 919 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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
FROM lukemathwalker/cargo-chef:0.1.66-rust-1.77.1-slim-bookworm AS chef
ENV BUILD_DIR /tmp/xelis-build
RUN mkdir -p $BUILD_DIR
WORKDIR $BUILD_DIR
# ---
FROM chef AS planner
ARG app
COPY . .
RUN cargo chef prepare --recipe-path recipe.json --bin $app
# ---
FROM chef AS builder
ARG app
ARG commit_hash
COPY --from=planner /tmp/xelis-build/recipe.json recipe.json
RUN cargo chef cook --release --recipe-path recipe.json --bin $app
COPY Cargo.toml Cargo.lock ./
COPY xelis_common ./xelis_common
COPY $app ./$app
RUN XELIS_COMMIT_HASH=${commit_hash} cargo build --release --bin $app
# ---
FROM gcr.io/distroless/cc-debian12
ARG app
ENV APP_DIR /var/run/xelis
ENV DATA_DIR $APP_DIR/data
ENV BINARY $APP_DIR/xelis
LABEL org.opencontainers.image.authors="Slixe <slixeprivate@gmail.com>"
COPY --from=builder /tmp/xelis-build/target/release/$app $BINARY
WORKDIR $DATA_DIR
ENTRYPOINT ["/var/run/xelis/xelis"]