-
Notifications
You must be signed in to change notification settings - Fork 9
Expand file tree
/
Copy pathContainerfile.sizer
More file actions
48 lines (33 loc) · 1.29 KB
/
Containerfile.sizer
File metadata and controls
48 lines (33 loc) · 1.29 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
# Build stage
FROM registry.access.redhat.com/ubi9/nodejs-22 AS builder
WORKDIR /app
RUN chown -R 1001:0 /app
USER 1001
# Copy workspace
COPY --chown=1001:0 package*.json ./
COPY --chown=1001:0 lib ./lib
COPY --chown=1001:0 service ./service
# Install all dependencies
RUN --mount=type=cache,target=/home/node/.npm \
npm install --legacy-peer-deps
# Build library and service
RUN npm run build:lib && npm run build:service
# Install runtime dependencies only (no dev dependencies)
RUN --mount=type=cache,target=/root/.npm \
npm install --legacy-peer-deps --omit=dev
# Runtime stage
FROM registry.access.redhat.com/ubi9/nodejs-22-minimal
WORKDIR /app
# Copy service dist
COPY --from=builder /app/service/dist ./dist
COPY --from=builder /app/service/package.json ./package.json
# Copy workspace node_modules (includes both service and library deps)
COPY --from=builder /app/node_modules ./node_modules
# Copy built library (workspace dependency)
COPY --from=builder /app/lib/dist ./lib/dist
COPY --from=builder /app/lib/package.json ./lib/package.json
ENV PORT=9200
EXPOSE 9200
HEALTHCHECK --interval=30s --timeout=3s --start-period=5s --retries=3 \
CMD node -e "require('http').get('http://localhost:9200/health', (r) => { process.exit(r.statusCode === 200 ? 0 : 1); });"
CMD ["node", "dist/server.js"]