-
Notifications
You must be signed in to change notification settings - Fork 15
/
Dockerfile
52 lines (49 loc) · 1.69 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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
FROM rust:1.76.0-alpine AS chef
RUN apk add --no-cache libc-dev
ENV CARGO_REGISTRIES_CRATES_IO_PROTOCOL=sparse
RUN cargo install cargo-chef --version 0.1.60 && \
rm -r $CARGO_HOME/registry
WORKDIR /src
FROM chef AS planner
COPY Cargo.toml Cargo.lock /src/
COPY aggregator /src/aggregator
COPY aggregator_api /src/aggregator_api
COPY aggregator_core /src/aggregator_core
COPY client /src/client
COPY collector /src/collector
COPY core /src/core
COPY integration_tests /src/integration_tests
COPY interop_binaries /src/interop_binaries
COPY messages /src/messages
COPY tools /src/tools
COPY xtask /src/xtask
RUN cargo chef prepare --recipe-path recipe.json
FROM chef AS builder
COPY --from=planner /src/recipe.json /src/recipe.json
RUN cargo chef cook --release -p janus_aggregator --features=prometheus,otlp
COPY Cargo.toml Cargo.lock /src/
COPY aggregator /src/aggregator
COPY aggregator_api /src/aggregator_api
COPY aggregator_core /src/aggregator_core
COPY client /src/client
COPY collector /src/collector
COPY core /src/core
COPY db /src/db
COPY integration_tests /src/integration_tests
COPY interop_binaries /src/interop_binaries
COPY messages /src/messages
COPY tools /src/tools
COPY xtask /src/xtask
ARG BINARY=aggregator
ARG GIT_REVISION=unknown
ENV GIT_REVISION ${GIT_REVISION}
RUN cargo build --release -p janus_aggregator --bin $BINARY --features=prometheus,otlp
FROM alpine:3.19.1 AS final
ARG BINARY=aggregator
ARG GIT_REVISION=unknown
LABEL revision ${GIT_REVISION}
COPY --from=builder /src/target/release/$BINARY /$BINARY
# Store the build argument in an environment variable so we can reference it
# from the ENTRYPOINT at runtime.
ENV BINARY=$BINARY
ENTRYPOINT ["/bin/sh", "-c", "exec /$BINARY \"$0\" \"$@\""]