File tree Expand file tree Collapse file tree 2 files changed +34
-8
lines changed
Expand file tree Collapse file tree 2 files changed +34
-8
lines changed Original file line number Diff line number Diff line change @@ -40,12 +40,35 @@ jobs:
4040 type=semver,pattern={{major}}.{{minor}}
4141 type=sha
4242
43- - name : Build and push
43+ - name : Build image
44+ id : build
4445 uses : docker/build-push-action@v5
4546 with :
4647 context : .
47- push : true
48+ push : false
49+ load : true
4850 tags : ${{ steps.meta.outputs.tags }}
4951 labels : ${{ steps.meta.outputs.labels }}
5052 cache-from : type=gha
5153 cache-to : type=gha,mode=max
54+
55+ - name : Set image ref for Trivy
56+ id : scan-ref
57+ run : |
58+ TAGS="${{ steps.meta.outputs.tags }}"
59+ FIRST_TAG="${TAGS%%$'\n'*}"
60+ echo "ref=${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${FIRST_TAG}" >> $GITHUB_OUTPUT
61+
62+ - name : Run Trivy vulnerability scanner
63+ uses : aquasecurity/trivy-action@master
64+ with :
65+ image-ref : ${{ steps.scan-ref.outputs.ref }}
66+ severity : CRITICAL
67+ exit-code : ' 1'
68+ format : table
69+
70+ - name : Push image
71+ run : |
72+ echo "${{ steps.meta.outputs.tags }}" | while read t; do
73+ [ -n "$t" ] && docker push "${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:$t"
74+ done
Original file line number Diff line number Diff line change 11FROM node:20-alpine AS builder
2+ RUN apk add --no-cache tini
23WORKDIR /app
3- COPY package.json ./
4- RUN npm install
4+ COPY package.json package-lock.json ./
5+ RUN npm ci
56COPY tsconfig.json ./
67COPY src ./src
78RUN NODE_OPTIONS=--max-old-space-size=4096 npx tsc
9+ RUN npm prune --production
810
9- FROM node:20-alpine
10- RUN apk add --no-cache tini
11+ FROM dhi.io/node:20-alpine3.23
1112WORKDIR /app
12- COPY package.json ./
13- RUN npm install --production
13+ COPY --from=builder /sbin/tini /sbin/tini
1414COPY --from=builder /app/dist ./dist
15+ COPY --from=builder /app/node_modules ./node_modules
16+ COPY package.json ./
17+
1518ENV RELAYER_NETWORK=mainnet
1619ENTRYPOINT ["/sbin/tini" , "--" ]
1720CMD ["node" , "dist/index.js" ]
You can’t perform that action at this time.
0 commit comments