forked from subquery/subql
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile
35 lines (26 loc) · 778 Bytes
/
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
# Build stage
FROM node:18-alpine as builder
# Set working directory
WORKDIR /app
# Copy all packages
COPY ./packages ./packages
# Copy tsconfig.json
COPY ./tsconfig.json ./tsconfig.json
# Copy build script
COPY ./scripts/build.sh ./scripts/build.sh
# Install dependencies and build
RUN ./scripts/build.sh packages/query
# Production stage
FROM node:18-alpine
# Copy .tgz file from builder
COPY --from=builder /app/packages/query/app.tgz /app.tgz
# Install production dependencies
RUN apk add --no-cache tini curl git && \
tar -xzvf /app.tgz --strip 1 && \
rm /app.tgz && \
yarn install --production && \
yarn cache clean && \
rm -rf /root/.npm /root/.cache
# Set Entry point and command
ENTRYPOINT ["/sbin/tini", "--", "bin/run"]
CMD ["-f","/app"]