-
-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy pathEarthfile
59 lines (48 loc) · 1.3 KB
/
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
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
VERSION 0.7
FROM rust:latest
WORKDIR /tokei_rs
install-chef:
ARG repo
RUN cargo install cargo-chef
SAVE IMAGE --push $repo/cache/install-chef
prepare:
ARG repo
FROM +install-chef
COPY --dir . .
RUN cargo chef prepare --recipe-path recipe.json
SAVE ARTIFACT recipe.json
SAVE IMAGE --push $repo/cache/prepare
build-deps:
ARG repo
FROM +install-chef
COPY +prepare/recipe.json ./
# build dependencies as separate layer to be cached
RUN cargo chef cook --release --recipe-path recipe.json
SAVE IMAGE --push $repo/cache/deps
build:
ARG repo
FROM +build-deps
# copy project
COPY --dir . .
# build, re-using the build artifacts from cargo chef
RUN cargo build --release
SAVE ARTIFACT target/release/tokei_rs tokei_rs
SAVE IMAGE --push $repo/cache/build
docker:
ARG repo
FROM ubuntu:jammy
EXPOSE 8000
COPY +build/tokei_rs tokei_rs
RUN apt-get update && apt-get upgrade -y && apt-get install -y git
ENTRYPOINT ["./tokei_rs"]
SAVE IMAGE --push $repo
compose:
ARG repo
FROM earthly/dind:alpine
WORKDIR /test
COPY compose.yml ./
WITH DOCKER \
--compose compose.yml \
--load $repo:latest(+docker)
RUN docker compose down && docker compose up --remove-orphans
END