-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdocker
37 lines (26 loc) · 904 Bytes
/
docker
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
# Build stage
FROM graphprotocol/graph-node:latest AS build
WORKDIR /app
COPY package.json yarn.lock ./
RUN yarn install
COPY . .
RUN graph codegen
# Runtime stage
FROM graphprotocol/graph-node:latest
WORKDIR /app
# Create a non-root user and group
RUN groupadd -r graph-node && useradd -r -g graph-node graph-node
# Copy necessary artifacts from the build stage
COPY --from=build /app/node_modules ./node_modules
COPY --from=build /app/schema.graphql ./schema.graphql
COPY --from=build /app/src ./src
COPY --from=build /app/subgraph.yaml ./subgraph.yaml
COPY --from=build /app/package.json ./package.json
COPY --from=build /app/yarn.lock ./yarn.lock
# Set ownership and permissions
USER graph-node
RUN chown -R graph-node:graph-node /app
# Define a health check
HEALTHCHECK --interval=30s --timeout=10s CMD curl -f http://localhost:8000/ || exit 1
# Start the Graph node
CMD ["graph", "node"]