Skip to content

Commit 5dba68f

Browse files
committed
build(frontend): enable multi-architecture yarn builds
Convert Dockerfile to use hermetic build approach with cachi2 and add support for multiple architectures (x64, arm64, s390x, ppc64) in yarn configuration. This resolves hermetic build failures on non-x86_64 architectures by ensuring all required architecture-specific packages are included in dependency resolution. The change simplifies the build process by removing complex corepack setup and cachito integration in favor of the standard hermetic build pattern used across OpenShift components.
1 parent 46a9c16 commit 5dba68f

File tree

2 files changed

+7
-35
lines changed

2 files changed

+7
-35
lines changed

Dockerfile

Lines changed: 3 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -7,51 +7,19 @@ ADD . /go/src/github.com/openshift/console/
77
WORKDIR /go/src/github.com/openshift/console/
88
RUN ./build-backend.sh
99

10-
1110
##################################################
1211
#
1312
# nodejs frontend build
1413
FROM registry.ci.openshift.org/ocp/builder:rhel-9-base-nodejs-openshift-4.22 AS nodebuilder
1514

1615
ADD . .
17-
1816
USER 0
1917

20-
ARG COREPACK_VERSION=0.34.6
21-
22-
# bootstrap corepack so we can install and run the other tools.
23-
RUN CACHED_COREPACK=./artifacts/corepack-${COREPACK_VERSION}.tar.gz; \
24-
if [ -f ${CACHED_COREPACK} ]; then \
25-
npm install --global ${CACHED_COREPACK}; \
26-
else \
27-
npm install --global https://github.com/nodejs/corepack/releases/download/v${COREPACK_VERSION}/corepack.tgz; \
28-
fi
29-
30-
RUN npx corepack enable
31-
32-
# assume our package manager is safe to download
33-
ENV COREPACK_ENABLE_DOWNLOAD_PROMPT=0
34-
35-
# The REMOTE_SOURCES value is set by the build system to indicate the location of the cachito-backed artifacts cache.
36-
# As cachito might not be available in all environments, we need to make sure the value is set before trying to use it and
37-
# that the COPY layer below doesn't fail. Setting it to be the Dockerfile itself is fairly safe, as it will always be
38-
# available.
39-
ARG REMOTE_SOURCES=./Dockerfile.product
40-
ARG REMOTE_SOURCE_DIR=/tmp/remote-sources
41-
42-
COPY $REMOTE_SOURCES $REMOTE_SOURCES_DIR
43-
44-
# use dependencies provided by Cachito
45-
RUN test -d ${REMOTE_SOURCES}/cachito-gomod-with-deps || exit 0; \
46-
cp -f $REMOTE_SOURCES_DIR/cachito-gomod-with-deps/app/registry-ca.pem . \
47-
&& cp -f $REMOTE_SOURCES_DIR/cachito-gomod-with-deps/app/frontend/{.npmrc,.yarnrc.yml,yarn.lock} frontend/
48-
49-
# prevent download of cypress binary as part of module installs
18+
WORKDIR frontend
5019
ENV CYPRESS_INSTALL_BINARY=0
5120

52-
# run the build
53-
RUN container-entrypoint ./build-frontend.sh
54-
21+
RUN node .yarn/releases/yarn-4.12.0.cjs install --immutable && \
22+
node .yarn/releases/yarn-4.12.0.cjs build
5523

5624
##################################################
5725
#

frontend/.yarnrc.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,4 +10,8 @@ nodeLinker: node-modules
1010

1111
npmMinimalAgeGate: 3d
1212

13+
supportedArchitectures:
14+
os: ["linux"]
15+
cpu: ["x64", "arm64", "s390x", "ppc64"]
16+
1317
yarnPath: .yarn/releases/yarn-4.12.0.cjs

0 commit comments

Comments
 (0)