-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathapp.dockerfile
33 lines (29 loc) · 1.06 KB
/
app.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
FROM oven/bun:slim as frontend
WORKDIR /frontend
COPY frontend /frontend
RUN bun install
RUN bun run build
FROM t348575/muslrust-chef:1.77.1-stable as chef
WORKDIR /tpm
FROM chef as planner
ADD app app
ADD common common
COPY ["Cargo.toml", "Cargo.lock", "."]
RUN perl -0777 -i -pe 's/members = \[[^\]]+\]/members = ["app", "common"]/igs' Cargo.toml
RUN cargo chef prepare --recipe-path recipe.json
FROM chef as builder
COPY --from=planner /tpm/recipe.json recipe.json
ARG RUSTFLAGS='-C strip=symbols -C linker=clang -C link-arg=-fuse-ld=/usr/local/bin/mold'
RUN RUSTFLAGS="$RUSTFLAGS" cargo chef cook --release --recipe-path recipe.json
ADD app app
ADD common common
COPY ["Cargo.toml", "Cargo.lock", "."]
RUN perl -0777 -i -pe 's/members = \[[^\]]+\]/members = ["app", "common"]/igs' Cargo.toml
RUN RUSTFLAGS="$RUSTFLAGS" cargo build --release --target x86_64-unknown-linux-musl
FROM scratch AS runtime
COPY --from=frontend /dist /dist
WORKDIR /
ENV LOG=info
COPY --from=builder /tpm/target/x86_64-unknown-linux-musl/release/twitch-points-miner /app
EXPOSE 3000
ENTRYPOINT ["/app"]