-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathDockerfile
59 lines (47 loc) · 1.61 KB
/
Dockerfile
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
###################
# --- builder --- #
###################
FROM docker.io/rust:1.84 AS builder
RUN apt-get update && \
apt-get -y dist-upgrade && \
apt-get -y install \
libclang-dev protobuf-compiler
ENV CARGO_NET_GIT_FETCH_WITH_CLI=true
RUN rustup target add wasm32-unknown-unknown
RUN rustup component add rust-src
WORKDIR /opt
ARG VERSION=polkadot-stable2412
RUN git clone https://github.com/paritytech/polkadot-sdk.git -b $VERSION --depth 1
WORKDIR /opt/polkadot-sdk
RUN cargo build --locked --release \
--bin polkadot \
--bin polkadot-execute-worker \
--bin polkadot-prepare-worker
##################
# --- runner --- #
##################
FROM docker.io/debian:12-slim
# Install curl for healthcheck
RUN apt-get update && \
apt-get install -y curl && \
rm -rf /var/lib/apt/lists/*
RUN addgroup --gid 65532 nonroot \
&& adduser --system --uid 65532 --gid 65532 --home /home/nonroot nonroot
COPY --from=builder /opt/polkadot-sdk/target/release/polkadot /usr/local/bin/polkadot
COPY --from=builder /opt/polkadot-sdk/target/release/polkadot-execute-worker /usr/local/bin/polkadot-execute-worker
COPY --from=builder /opt/polkadot-sdk/target/release/polkadot-prepare-worker /usr/local/bin/polkadot-prepare-worker
USER 65532
# P2P
EXPOSE 30333
# HTTP RPC
EXPOSE 9933
# WebSocket RPC
EXPOSE 9944
# Prometheus
EXPOSE 9615
VOLUME /data
HEALTHCHECK --interval=30s --timeout=10s --retries=3 --start-period=30s \
CMD curl -H "Content-Type: application/json" \
-d '{"id":1, "jsonrpc":"2.0", "method":"system_health", "params":[]}' \
http://localhost:9944
ENTRYPOINT [ "/usr/local/bin/polkadot" ]