-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathDockerfile
31 lines (26 loc) · 1.05 KB
/
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
FROM --platform=$TARGETPLATFORM rust:1.75.0-slim AS chef
ARG TARGETPLATFORM
ARG BUILDPLATFORM
RUN cargo install cargo-chef
WORKDIR /usr/src/temporal-rust-worker
FROM chef AS planner
ARG TARGETPLATFORM
ARG BUILDPLATFORM
COPY . .
RUN cargo chef prepare --recipe-path recipe.json
FROM chef AS builder
ARG TARGETPLATFORM
ARG BUILDPLATFORM
ARG RUST_TARGET_ARCH=aarch64-unknown-linux-gnu
COPY --from=planner /usr/src/temporal-rust-worker/recipe.json recipe.json
RUN echo "Building on $BUILDPLATFORM for $TARGETPLATFORM"
RUN apt-get update && apt-get install -y protobuf-compiler
ENV RUSTFLAGS='-C target-feature=+crt-static'
RUN cargo chef cook --profile release --target ${RUST_TARGET_ARCH} --recipe-path recipe.json
COPY . .
RUN cargo build --release --target ${RUST_TARGET_ARCH}
FROM --platform=$TARGETPLATFORM cgr.dev/chainguard/static
ARG RUST_TARGET_ARCH=aarch64-unknown-linux-gnu
COPY --from=builder /usr/src/temporal-rust-worker/target/${RUST_TARGET_ARCH}/release/temporal-rust-worker /usr/local/bin/temporal-rust-worker
USER 65532:65532
CMD ["temporal-rust-worker"]