-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
89 lines (63 loc) · 2.7 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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
FROM python:3.11-slim-bullseye AS base
FROM base AS builder
RUN apt update
RUN apt install -y gcc
RUN pip install pdm
WORKDIR /project
RUN pdm venv create --with venv
ADD pyproject.toml .
ADD pdm.lock .
RUN pdm sync --no-self --prod
ADD sqa sqa/
ADD README.md .
FROM builder AS writer-builder
RUN pdm sync -G writer --no-editable --prod
FROM base AS writer-base
COPY --from=writer-builder /project/.venv /app/env/
COPY --from=writer-builder /project/sqa /app/sqa/
FROM writer-base AS eth-ingest
RUN /app/env/bin/python -m sqa.eth.ingest --help > /dev/null # win a little bit of startup time
ENTRYPOINT ["/app/env/bin/python", "-m", "sqa.eth.ingest"]
FROM writer-base AS solana-writer
RUN /app/env/bin/python -m sqa.solana.writer --help > /dev/null # win a little bit of startup time
ENTRYPOINT ["/app/env/bin/python", "-m", "sqa.solana.writer"]
FROM writer-base AS substrate-writer
RUN /app/env/bin/python -m sqa.substrate.writer --help > /dev/null # win a little bit of startup time
ENTRYPOINT ["/app/env/bin/python", "-m", "sqa.substrate.writer"]
FROM writer-base AS tron-writer
RUN /app/env/bin/python -m sqa.tron.writer --help > /dev/null # win a little bit of startup time
ENTRYPOINT ["/app/env/bin/python", "-m", "sqa.tron.writer"]
FROM writer-base AS starknet-writer
RUN /app/env/bin/python -m sqa.starknet.writer --help > /dev/null # win a little bit of startup time
ENTRYPOINT ["/app/env/bin/python", "-m", "sqa.starknet.writer"]
FROM writer-base AS fuel-writer
RUN /app/env/bin/python -m sqa.fuel.writer --help > /dev/null # win a little bit of startup time
ENTRYPOINT ["/app/env/bin/python", "-m", "sqa.fuel.writer"]
FROM builder AS worker-builder
RUN pdm sync -G http-worker --no-editable --prod
FROM base AS worker
COPY --from=worker-builder /project/.venv /app/env/
COPY --from=worker-builder /project/sqa /app/sqa/
RUN /app/env/bin/python -m sqa.worker --help > /dev/null # win a little bit of startup time
ENTRYPOINT ["/app/env/bin/python", "-m", "sqa.worker"]
FROM builder as p2p-worker-builder
RUN pdm sync -G p2p-worker --no-editable --prod
FROM base as p2p-worker
COPY --from=p2p-worker-builder /project/.venv /app/env/
COPY --from=p2p-worker-builder /project/sqa /app/sqa/
VOLUME /app/data
ENV DATA_DIR=/app/data
ENV PING_INTERVAL_SEC=20
ENV LOGS_SEND_INTERVAL_SEC=600
ENV PROMETHEUS_PORT=9090
ENV NUM_WORKER_PROC=16
RUN echo "#!/bin/bash \n exec /app/env/bin/python -m sqa.worker.p2p \
--data-dir \${DATA_DIR} \
--procs \${NUM_WORKER_PROC} \
--proxy \${PROXY_ADDR} \
--prometheus-port \${PROMETHEUS_PORT} \
--scheduler-id \${SCHEDULER_ID} \
--rpc-url \${RPC_URL} \
--logs-collector-id \${LOGS_COLLECTOR_ID}" > ./entrypoint.sh
RUN chmod +x ./entrypoint.sh
ENTRYPOINT ["./entrypoint.sh"]