-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile.indexer
More file actions
52 lines (48 loc) · 2.31 KB
/
Copy pathDockerfile.indexer
File metadata and controls
52 lines (48 loc) · 2.31 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
# Dockerfile.indexer — builds midnightntwrk/indexer-standalone v4.0.1 with the
# locally-modified ledger crates from deps/midnight-ledger, so its Zswap
# verifier keys match the rebuilt node.
#
# Build context: repo root (so both deps/midnight-indexer and
# deps/midnight-ledger are visible).
#
# docker build -f Dockerfile.indexer -t split-prove/indexer-standalone:local .
ARG RUST_VERSION=1.94.0
FROM lukemathwalker/cargo-chef:0.1.77-rust-${RUST_VERSION}-trixie AS chef
WORKDIR /build
# Stage the ledger sources at a stable path the indexer's relative paths
# (../midnight-ledger/...) can reach. The indexer workspace is built from
# /build/midnight-indexer; ../midnight-ledger resolves to /build/midnight-ledger.
FROM chef AS planner
COPY deps/midnight-ledger ./midnight-ledger
COPY deps/midnight-indexer ./midnight-indexer
WORKDIR /build/midnight-indexer
RUN cargo chef prepare --recipe-path recipe.json
FROM chef AS builder
SHELL ["/bin/bash", "-c"]
ARG PROFILE=release
COPY deps/midnight-ledger ./midnight-ledger
COPY --from=planner /build/midnight-indexer/recipe.json /build/midnight-indexer/recipe.json
WORKDIR /build/midnight-indexer
RUN cargo chef cook --profile ${PROFILE} --recipe-path recipe.json --features standalone -p indexer-standalone
COPY deps/midnight-indexer /build/midnight-indexer
RUN cargo build -p indexer-standalone --locked --features standalone --profile ${PROFILE} && \
mkdir -p /runtime/usr/local/bin && \
mv "./target/${PROFILE/dev/debug}/indexer-standalone" /runtime/usr/local/bin && \
mv ./indexer-standalone/bin/entrypoint.sh /runtime/usr/local/bin && \
mkdir -p /runtime/opt/indexer-standalone && \
mv ./indexer-standalone/config.yaml /runtime/opt/indexer-standalone
FROM debian:trixie-slim@sha256:f6e2cfac5cf956ea044b4bd75e6397b4372ad88fe00908045e9a0d21712ae3ba AS runtime
RUN apt-get update && \
apt-get install -y --no-install-recommends ca-certificates && \
rm -rf /var/lib/apt/lists/*
RUN useradd -u 10001 -d /nonexistent -s /usr/sbin/nologin -M -c "" appuser && \
passwd -l appuser && \
mkdir /var/run/indexer-standalone && \
chown appuser:appuser /var/run/indexer-standalone && \
mkdir /data && \
chown appuser:appuser /data
COPY --from=builder --chown=appuser:appuser /runtime /
USER appuser
WORKDIR /opt/indexer-standalone
ENTRYPOINT ["entrypoint.sh"]
EXPOSE 8088