forked from StellarRouter/StellarRouter
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
68 lines (60 loc) · 2.84 KB
/
Copy pathDockerfile
File metadata and controls
68 lines (60 loc) · 2.84 KB
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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
# syntax=docker/dockerfile:1
# ── Build stage ───────────────────────────────────────────────────────────────
FROM rust:1.88-slim AS builder
# Install wasm32 target for contract compilation
RUN apt-get update && apt-get install -y --no-install-recommends curl && rm -rf /var/lib/apt/lists/*
RUN rustup target add wasm32-unknown-unknown
WORKDIR /app
# Cache dependencies before copying source
COPY Cargo.toml ./
COPY contracts/ contracts/
COPY metrics/ metrics/
COPY integration-tests/ integration-tests/
COPY api-server/ api-server/
# Build all workspace members except metrics (which has external dependency issues)
RUN cargo build \
--package router-common \
--package router-core \
--package router-registry \
--package router-access \
--package router-middleware \
--package router-timelock \
--package router-multicall \
--package router-quote \
--package router-execution \
--package router-api-server \
2>&1
# ── Test stage ────────────────────────────────────────────────────────────────
FROM builder AS test
CMD ["cargo", "test", \
"--package", "router-common", \
"--package", "router-core", \
"--package", "router-registry", \
"--package", "router-access", \
"--package", "router-middleware", \
"--package", "router-timelock", \
"--package", "router-multicall", \
"--package", "router-quote", \
"--package", "router-execution", \
"--package", "router-api-server"]
# ── WASM build stage ──────────────────────────────────────────────────────────
FROM builder AS wasm
RUN cargo build --target wasm32-unknown-unknown --release \
--package router-core \
--package router-registry \
--package router-access \
--package router-middleware \
--package router-timelock \
--package router-multicall
# ── Metrics exporter runtime ──────────────────────────────────────────────────
FROM builder AS metrics-builder
RUN cargo build --release --package router-metrics-exporter
FROM debian:bookworm-slim AS metrics
RUN apt-get update && \
apt-get install -y --no-install-recommends ca-certificates curl && \
rm -rf /var/lib/apt/lists/*
COPY --from=metrics-builder /app/target/release/router-metrics-exporter /usr/local/bin/
EXPOSE 9090
HEALTHCHECK --interval=30s --timeout=5s --start-period=10s --retries=3 \
CMD curl -f http://localhost:9090/health || exit 1
ENTRYPOINT ["router-metrics-exporter"]