-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathDockerfile
48 lines (35 loc) · 1.02 KB
/
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
36
37
38
39
40
41
42
43
44
45
46
47
48
# 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/node
# Production stage
FROM node:18-alpine
# Copy .tgz file from builder
COPY --from=builder /app/packages/node/app.tgz /app.tgz
# Install production dependencies
RUN apk add --no-cache tini curl git && \
apk add --no-cache python3 make g++ && \
npm install -g node-gyp
# Install the app
RUN npm i -g app.tgz
# Clean up unused deps
RUN rm /app.tgz && \
yarn cache clean && \
rm -rf /root/.npm /root/.cache
# Create ./.monitor directory and set permissions
RUN mkdir -p .monitor && \
chown 1000:1000 .monitor
# Make the user not ROOT
USER 1000
ENV TZ=utc
# Set Entry point and command
ENTRYPOINT ["/sbin/tini", "--", "/usr/local/lib/node_modules/@subql/node-algorand/bin/run"]
CMD ["-f","/app"]