-
Notifications
You must be signed in to change notification settings - Fork 133
/
Dockerfile.indexer-cli
74 lines (50 loc) · 2.19 KB
/
Dockerfile.indexer-cli
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
########################################################################
# Build image
FROM node:20.11-bookworm-slim as build
ENV NODE_ENV production
RUN apt-get update && apt-get install -y python3 build-essential git curl
# Install Rust
RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs > /tmp/rustup.sh && sh /tmp/rustup.sh -y
ENV PATH="/root/.cargo/bin:$PATH"
WORKDIR /opt/indexer
# Copy root files
COPY package.json .
COPY yarn.lock .
COPY tsconfig.json .
COPY lerna.json .
# Copy shared and package files
COPY packages/indexer-common/ ./packages/indexer-common
COPY packages/indexer-native/ ./packages/indexer-native
COPY packages/indexer-cli/ ./packages/indexer-cli
# Install dependencies; include dev dependencies
RUN yarn --frozen-lockfile --non-interactive --production=false
########################################################################
# Runtime image
FROM node:20.11-bookworm-slim
ENV NODE_ENV production
RUN apt-get update && apt-get install -y python3 build-essential git curl
# Install Rust
RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs > /tmp/rustup.sh && sh /tmp/rustup.sh -y
ENV PATH="/root/.cargo/bin:$PATH"
WORKDIR /opt/indexer
# Copy root files
COPY package.json .
COPY yarn.lock .
COPY tsconfig.json .
COPY lerna.json .
# Copy build output
COPY --from=build /opt/indexer/packages/indexer-common/package.json /opt/indexer/packages/indexer-common/package.json
COPY --from=build /opt/indexer/packages/indexer-common/dist /opt/indexer/packages/indexer-common/dist
COPY --from=build /opt/indexer/packages/indexer-cli/package.json /opt/indexer/packages/indexer-cli/package.json
COPY --from=build /opt/indexer/packages/indexer-cli/dist /opt/indexer/packages/indexer-cli/dist
COPY --from=build /opt/indexer/packages/indexer-cli/bin /opt/indexer/packages/indexer-cli/bin
# Install dependencies; exclude dev dependencies
RUN yarn --frozen-lockfile --non-interactive --production=true
RUN ln -s /opt/indexer/packages/indexer-cli/bin/graph-indexer /usr/bin/graph
ENV ETHEREUM ""
ENV USER=graph
ENV UID=10001
RUN adduser --disabled-password --gecos "" --home "/home/graph" --shell "/bin/bash" --uid "${UID}" "${USER}"
WORKDIR /home/${USER}
USER ${USER}
ENTRYPOINT ["cat"]