forked from Maki-Zeninn/stellar-router
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
69 lines (61 loc) · 3.03 KB
/
Copy pathDockerfile
File metadata and controls
69 lines (61 loc) · 3.03 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
69
# syntax=docker/dockerfile:1
# ── Build stage ───────────────────────────────────────────────────────────────
FROM rust:1.88-slim AS builder
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
COPY Cargo.toml Cargo.lock ./
COPY contracts/ contracts/
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
# ── 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"]
# ── 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 \
--package router-execution
# ── Metrics exporter builder ──────────────────────────────────────────────────
# router-metrics-exporter is its own standalone workspace (see metrics/Cargo.toml),
# not a member of the root workspace, so it's built separately.
FROM rust:1.88-slim AS metrics-builder
RUN apt-get update && \
apt-get install -y --no-install-recommends curl ca-certificates && \
rm -rf /var/lib/apt/lists/*
WORKDIR /app
COPY metrics/ metrics/
RUN cargo build --release --manifest-path metrics/Cargo.toml
# ── Metrics exporter runtime ──────────────────────────────────────────────────
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/metrics/target/release/router-metrics-exporter /usr/local/bin/
RUN useradd -m -u 1000 metrics && \
chown -R metrics:metrics /usr/local/bin/router-metrics-exporter
USER metrics
EXPOSE 9090
ENTRYPOINT ["router-metrics-exporter"]