-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
39 lines (31 loc) · 1.31 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
FROM node:18-bullseye-slim as base
###################################################
# Builder image
###################################################
FROM base AS builder
WORKDIR /app
RUN apt-get update && apt-get install -y bash
COPY --chown=node:node ./src ./src
COPY --chown=node:node ./bin ./bin
COPY --chown=node:node ./.tsconfig.json ./.tsconfig.json
COPY --chown=node:node ./package.json ./package.json
COPY --chown=node:node ./package-lock.json ./package-lock.json
RUN npm i
# Remove write permission from executables -- SonarCloud rule docker:S6504
RUN find . -type f -executable -exec chmod -w {} \;
###################################################
# Runner image
###################################################
FROM base AS runner
WORKDIR /app
#Add tini - available at /sbin/tini
RUN apt-get update && apt-get install -y tini bash wget
# Copy compiled project from builder
USER node
COPY --chown=node:node --from=builder /app/package.json ./package.json
COPY --chown=node:node --from=builder /app/bin ./bin
COPY --chown=node:node --from=builder /app/lib ./lib
COPY --chown=node:node --from=builder /app/node_modules ./node_modules
# We use tini so that node process does not run as PID 1
# as doing so causes it to ignore certains signals like SIGINT.
ENTRYPOINT ["tini", "--", "./bin/faros-scan-result-reporter"]