-
Notifications
You must be signed in to change notification settings - Fork 75
Expand file tree
/
Copy pathhardened.Dockerfile
More file actions
57 lines (43 loc) · 1.16 KB
/
hardened.Dockerfile
File metadata and controls
57 lines (43 loc) · 1.16 KB
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
49
50
51
52
53
54
55
56
57
FROM dhi.io/node:24-alpine3.23-sfw-dev AS web
RUN mkdir -p /app && chown -R node /app
USER node
WORKDIR /app
COPY package*.json .npmrc ./
COPY --chown=node web/package.json web/
RUN --mount=type=cache,target=/root/.npm \
npm \
--ignore-scripts \
--include-workspace-root \
--no-fund \
--workspace web \
ci
COPY --chown=node web/ web/
RUN npm --workspace web run build
FROM dhi.io/node:24-alpine3.23-sfw-dev AS deps
RUN mkdir -p /app && chown -R node /app
USER node
WORKDIR /app
COPY package*.json .npmrc ./
COPY --chown=node api/package.json api/
RUN --mount=type=cache,target=/root/.npm \
npm \
--ignore-scripts \
--include-workspace-root \
--no-fund \
--omit dev \
--workspace api \
ci
FROM dhi.io/node:24-alpine3.23
USER node
WORKDIR /app
COPY package*.json .npmrc ./
COPY api/ api/
# Enable below instruction if required
# COPY --from=deps /app/api/node_modules/ api/node_modules/
COPY --from=web /app/api/static api/static/
COPY bin/healthCheck.js bin/start.js bin/
COPY --from=deps /app/node_modules node_modules/
EXPOSE 80
ENV PORT=80
HEALTHCHECK --start-period=10s --timeout=5s CMD [ "/app/bin/healthCheck.js" ]
CMD [ "/app/bin/start.js" ]