forked from graphprotocol/indexer
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile.indexer-service
67 lines (48 loc) · 2.27 KB
/
Dockerfile.indexer-service
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
########################################################################
# Build image
FROM node:16.15-bullseye-slim as build
ENV NODE_ENV production
RUN apt-get update && apt-get install -y python 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 lerna.json .
COPY tsconfig.json .
# Copy shared and package files
COPY packages/indexer-common/ ./packages/indexer-common
COPY packages/indexer-native/ ./packages/indexer-native
COPY packages/indexer-service/ ./packages/indexer-service
# Install dependencies; include dev dependencies
RUN yarn --frozen-lockfile --non-interactive --production=false
########################################################################
# Runtime image
FROM node:16.15-bullseye-slim
ENV NODE_ENV production
RUN apt-get update && apt-get install -y python 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 lerna.json .
COPY tsconfig.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-native/package.json /opt/indexer/packages/indexer-native/package.json
COPY --from=build /opt/indexer/packages/indexer-native/lib /opt/indexer/packages/indexer-native/lib
COPY --from=build /opt/indexer/packages/indexer-native/native /opt/indexer/packages/indexer-native/native
COPY --from=build /opt/indexer/packages/indexer-service/package.json /opt/indexer/packages/indexer-service/package.json
COPY --from=build /opt/indexer/packages/indexer-service/dist /opt/indexer/packages/indexer-service/dist
# Install dependencies; exclude dev dependencies
RUN yarn --frozen-lockfile --non-interactive
ENV ETHEREUM ""
# Run the indexer-service
WORKDIR /opt/indexer/packages/indexer-service
ENTRYPOINT ["node", "dist/index.js", "start"]