File tree Expand file tree Collapse file tree 1 file changed +47
-0
lines changed
Expand file tree Collapse file tree 1 file changed +47
-0
lines changed Original file line number Diff line number Diff line change 1+ FROM lukemathwalker/cargo-chef:latest-rust-1 AS chef
2+ WORKDIR /app
3+
4+ LABEL org.opencontainers.image.source=https://github.com/ithacaxyz/odyssey
5+ LABEL org.opencontainers.image.licenses="MIT OR Apache-2.0"
6+
7+ # Builds a cargo-chef plan
8+ FROM chef AS planner
9+ COPY . .
10+ RUN cargo chef prepare --recipe-path recipe.json
11+
12+ FROM chef AS builder
13+ COPY --from=planner /app/recipe.json recipe.json
14+
15+ # Build profile, release by default
16+ ARG BUILD_PROFILE=release
17+ ENV BUILD_PROFILE $BUILD_PROFILE
18+
19+ # Extra Cargo features
20+ ARG FEATURES=""
21+ ENV FEATURES $FEATURES
22+
23+ # Install system dependencies
24+ RUN apt-get update && apt-get -y upgrade && apt-get install -y libclang-dev pkg-config
25+
26+ # Builds dependencies
27+ RUN cargo chef cook --profile $BUILD_PROFILE --recipe-path recipe.json
28+
29+ # Build application
30+ COPY . .
31+ RUN cargo build --profile $BUILD_PROFILE --features "$FEATURES" --locked --bin odyssey-relay
32+
33+ # ARG is not resolved in COPY so we have to hack around it by copying the
34+ # binary to a temporary location
35+ RUN cp /app/target/$BUILD_PROFILE/relay /app/relay
36+
37+ # Use Ubuntu as the release image
38+ FROM ubuntu AS runtime
39+ WORKDIR /app
40+
41+ # Copy relay over from the build stage
42+ COPY --from=builder /app/relay /usr/local/bin
43+
44+ # Copy licenses
45+ COPY LICENSE-* ./
46+
47+ ENTRYPOINT ["/usr/local/bin/relay"]
You can’t perform that action at this time.
0 commit comments