-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Earthfile
62 lines (40 loc) · 1.37 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
60
61
VERSION 0.7
all:
BUILD +docker
docker:
ARG tag=latest
FROM scratch
COPY +build/september .
EXPOSE 80
CMD ["./september"]
SAVE IMAGE --push fuwn/september:$tag
deps:
ARG rustc="1.76.0"
FROM clux/muslrust:$rustc
RUN curl "https://static.rust-lang.org/rustup/archive/${RUSTUP_VER}/${RUST_ARCH}/rustup-init" -o rustup-init \
&& chmod +x rustup-init \
&& ./rustup-init -y --default-toolchain $rustc --profile minimal \
&& rm rustup-init \
&& ~/.cargo/bin/rustup target add x86_64-unknown-linux-musl \
&& echo "[build]\ntarget = \"x86_64-unknown-linux-musl\"" > ~/.cargo/config
RUN apt-get update && apt-get install -y gnupg2
RUN curl -fsSL https://apt.llvm.org/llvm-snapshot.gpg.key | apt-key add - \
&& apt-get install -y clang
build:
FROM +deps
WORKDIR /source
RUN cargo new september
WORKDIR /source/september
COPY Cargo.* .
RUN cargo build --release
COPY .git .git
COPY src src
COPY build.rs build.rs
COPY Cargo.* .
COPY default.css .
RUN --mount=type=cache,target=/source/september/target \
--mount=type=cache,target=/root/.cargo/registry \
cargo build --release --bin september \
&& strip -s /source/september/target/x86_64-unknown-linux-musl/release/september \
&& mv /source/september/target/x86_64-unknown-linux-musl/release/september .
SAVE ARTIFACT /source/september/september