-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
39 lines (25 loc) · 839 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
##
# Adapted from this GitHub answer: https://github.com/emk/rust-musl-builder/issues/151#issuecomment-1515373012
##
# Chef
FROM messense/rust-musl-cross:x86_64-musl as chef
RUN cargo install cargo-chef
WORKDIR /barista
# Planner
FROM chef as planner
COPY . .
RUN cargo chef prepare --recipe-path recipe.json
# Builder
FROM chef as builder
RUN apt-get update -y
RUN apt-get install -y pkg-config libssl-dev
COPY --from=planner /barista/recipe.json recipe.json
RUN rustup target add x86_64-unknown-linux-musl
RUN cargo chef cook --release --target x86_64-unknown-linux-musl --recipe-path recipe.json
COPY . .
RUN ls
RUN cargo build --release --target x86_64-unknown-linux-musl
# Run :)
FROM scratch
COPY --from=builder /barista/target/x86_64-unknown-linux-musl/release/barista /usr/local/bin/barista
ENTRYPOINT [ "barista" ]