88# just use that. For now we work around this by copying a tarball.
99ENV GOCACHE="/go/rhel9/.cache"
1010ENV GOMODCACHE="/go/rhel9/pkg/mod"
11- RUN --mount=type=cache,target=/go/rhel9/.cache,z \
12- --mount=type=cache,target=/go/rhel9/pkg/mod,z \
13- make install DESTDIR=./instroot-rhel9 && tar -C instroot-rhel9 -cf instroot-rhel9.tar .
11+ RUN make install DESTDIR=./instroot-rhel9 && tar -C instroot-rhel9 -cf instroot-rhel9.tar .
1412
1513# Add a RHEL 8 builder to compile the RHEL 8 compatible binaries
1614FROM registry.ci.openshift.org/ocp/builder:rhel-8-golang-1.24-openshift-4.21 AS rhel8-builder
@@ -20,15 +18,12 @@ WORKDIR /go/src/github.com/openshift/machine-config-operator
2018COPY . .
2119ENV GOCACHE="/go/rhel8/.cache"
2220ENV GOMODCACHE="/go/rhel8/pkg/mod"
23- RUN --mount=type=cache,target=/go/rhel8/.cache,z \
24- --mount=type=cache,target=/go/rhel8/pkg/mod,z \
25- make install DESTDIR=./instroot-rhel8 && tar -C instroot-rhel8 -cf instroot-rhel8.tar .
21+ RUN make install DESTDIR=./instroot-rhel8 && tar -C instroot-rhel8 -cf instroot-rhel8.tar .
2622
2723FROM registry.ci.openshift.org/ocp/4.21:base-rhel9
2824ARG TAGS=""
2925COPY install /manifests
30- RUN --mount=type=cache,target=/var/cache/dnf,z \
31- if [ "${TAGS}" = "fcos" ]; then \
26+ RUN if [ "${TAGS}" = "fcos" ]; then \
3227 # comment out non-base/extensions image-references entirely for fcos
3328 sed -i '/- name: rhel-coreos-/,+3 s/^/#/' /manifests/image-references && \
3429 # also remove extensions from the osimageurl configmap (if we don't, oc won't rewrite it, and the placeholder value will survive and get used)
@@ -45,7 +40,8 @@ RUN --mount=type=cache,target=/var/cache/dnf,z \
4540 # Create the build user which will be used for doing OS image builds. We
4641 # use the username "build" and the uid 1000 since this matches what is in
4742 # the official Buildah image.
48- useradd --uid 1000 build
43+ # Conditional checks if "build" user does not exist before adding user.
44+ if ! id -u "build" >/dev/null 2>&1; then useradd --uid 1000 build; fi
4945# Copy the binaries *after* we install nmstate so we don't invalidate our cache for local builds.
5046COPY --from=rhel9-builder /go/src/github.com/openshift/machine-config-operator/instroot-rhel9.tar /tmp/instroot-rhel9.tar
5147RUN cd / && tar xf /tmp/instroot-rhel9.tar && rm -f /tmp/instroot-rhel9.tar
0 commit comments