Skip to content

Commit e725ea1

Browse files
authored
chore: add dockerfile for wallet service (#113)
1 parent 19548cf commit e725ea1

File tree

1 file changed

+47
-0
lines changed

1 file changed

+47
-0
lines changed

Dockerfile.relay

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
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"]

0 commit comments

Comments
 (0)