forked from namehash/ensnode
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile.data
More file actions
50 lines (39 loc) · 1.45 KB
/
Dockerfile.data
File metadata and controls
50 lines (39 loc) · 1.45 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
# Base working stage
FROM node:22-slim AS base
ENV PNPM_HOME="/pnpm"
ENV PATH="$PNPM_HOME:$PATH"
RUN corepack enable
WORKDIR /app
###################
## Data Stage — download ENS Subgraph rainbow table archive & checksum
###################
FROM base AS db-data
RUN apt-get update && apt-get install -y wget
COPY apps/ensrainbow/download-rainbow-tables.sh .
# Allow parametrization of which data version to download
# Possible values: "v1" (default) or "v2" or "test"
# This ARG is used to determine which data fetching command to run during the build process.
# It can be set using the --build-arg flag when building the Docker image.
ARG DATA_VERSION="v1"
RUN DATA_VERSION=${DATA_VERSION} ./download-rainbow-tables.sh
###################
## Ingest Stage — ingest to produce data dir artifact
###################
FROM base AS ingest
COPY . .
RUN --mount=type=cache,id=pnpm,target=/pnpm/store pnpm install --frozen-lockfile --ignore-scripts
WORKDIR /app/apps/ensrainbow
# copy ens_names.sql.gz from db-data
COPY --from=db-data /app/ens_names.sql.gz /app/THE_GRAPH_LICENSE.txt .
# produce the data dir artifact
RUN pnpm run ingest
# cleanup input file to reduce layer size
RUN rm ens_names.sql.gz
###################
## Output Image — just the data dir
###################
FROM base AS ensrainbow-data
ARG DATA_VERSION="v1"
# Set a label to identify the data version
LABEL io.ensnode.data-version=${DATA_VERSION}
COPY --from=ingest /app/apps/ensrainbow/data ./data