forked from earthly/earthly
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Earthfile
34 lines (29 loc) · 914 Bytes
/
Earthfile
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
VERSION 0.6
FROM rust:1.59
WORKDIR /rustexample
install-chef:
RUN cargo install --debug cargo-chef
prepare-cache:
FROM +install-chef
COPY --dir src Cargo.lock Cargo.toml .
RUN cargo chef prepare
SAVE ARTIFACT recipe.json
# Using cutoff-optimization to ensure cache hit (see examples/cutoff-optimization)
build-cache:
FROM +install-chef
COPY +prepare-cache/recipe.json ./
RUN cargo chef cook --release
SAVE ARTIFACT target
SAVE ARTIFACT $CARGO_HOME cargo_home
build:
COPY --dir src Cargo.lock Cargo.toml .
COPY +build-cache/cargo_home $CARGO_HOME
COPY +build-cache/target target
RUN cargo build --release --bin example-rust
SAVE ARTIFACT target/release/example-rust example-rust
docker:
FROM debian:buster-slim
COPY +build/example-rust example-rust
EXPOSE 9091
ENTRYPOINT ["./example-rust"]
SAVE IMAGE --push earthly/examples:rust