-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathmock.dockerfile
25 lines (22 loc) · 901 Bytes
/
mock.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
FROM t348575/muslrust-chef:1.77.1-stable as chef
WORKDIR /tpm
FROM chef as planner
ADD mock mock
ADD common common
COPY ["Cargo.toml", "Cargo.lock", "."]
RUN perl -0777 -i -pe 's/members = \[[^\]]+\]/members = ["mock", "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 --recipe-path recipe.json
ADD mock mock
ADD common common
COPY ["Cargo.toml", "Cargo.lock", "."]
RUN perl -0777 -i -pe 's/members = \[[^\]]+\]/members = ["mock", "common"]/igs' Cargo.toml
RUN RUSTFLAGS="$RUSTFLAGS" cargo build --target x86_64-unknown-linux-musl
FROM busybox AS runtime
WORKDIR /
COPY --from=builder /tpm/target/x86_64-unknown-linux-musl/debug/mock /app
EXPOSE 3000
ENTRYPOINT ["/app"]