-
Notifications
You must be signed in to change notification settings - Fork 85
/
Dockerfile.prow
35 lines (30 loc) · 1.47 KB
/
Dockerfile.prow
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
# Copyright Contributors to the Open Cluster Management project
FROM registry.ci.openshift.org/stolostron/builder:nodejs20-linux as frontend-packages
WORKDIR /app/frontend
# Copy only package.json and package-lock.json so that the docker cache hash only changes if those change
# This will cause the npm ci to only rerun if the package.json or package-lock.json changes
COPY ./frontend/package.json ./frontend/package-lock.json ./
RUN npm ci --legacy-peer-deps
COPY ./frontend .
FROM frontend-packages as dynamic-plugin
RUN npm run build:plugin:acm
FROM registry.ci.openshift.org/stolostron/builder:nodejs20-linux as backend
WORKDIR /app/backend
# Copy only package.json and package-lock.json so that the docker layer cache only changes if those change
# This will cause the npm ci to only rerun if the package.json or package-lock.json changes
COPY ./backend/package.json ./backend/package-lock.json ./
RUN npm ci --omit=optional
COPY ./backend .
RUN npm run build
FROM registry.ci.openshift.org/stolostron/builder:nodejs20-linux as production
WORKDIR /app/backend
COPY ./backend/package-lock.json ./backend/package.json ./
RUN npm ci --omit=optional --only=production
FROM registry.ci.openshift.org/stolostron/common-nodejs-parent:nodejs-20
WORKDIR /app
ENV NODE_ENV production
COPY --from=production /app/backend/node_modules ./node_modules
COPY --from=backend /app/backend/backend.mjs ./
COPY --from=dynamic-plugin /app/frontend/plugins/acm/dist ./public/plugin
USER 1001
CMD ["node", "backend.mjs"]