Skip to content

Commit 7fae2f5

Browse files
cheesesashimiisabella-janssen
authored andcommitted
remove --mount directives
These were added to speed up local image builds. However, it looks like there is an interaction between runc and Buildah that prevents these directives from being used (https://issues.redhat.com/browse/RHEL-129120). Once that is resolved, we should revert this PR.
1 parent 6c5a56b commit 7fae2f5

File tree

2 files changed

+8
-17
lines changed

2 files changed

+8
-17
lines changed

Dockerfile

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,7 @@ COPY . .
77
# just use that. For now we work around this by copying a tarball.
88
ENV GOCACHE="/go/rhel9/.cache"
99
ENV GOMODCACHE="/go/rhel9/pkg/mod"
10-
RUN --mount=type=cache,target=/go/rhel9/.cache,z \
11-
--mount=type=cache,target=/go/rhel9/pkg/mod,z \
12-
make install DESTDIR=./instroot-rhel9 && tar -C instroot-rhel9 -cf instroot-rhel9.tar .
10+
RUN make install DESTDIR=./instroot-rhel9 && tar -C instroot-rhel9 -cf instroot-rhel9.tar .
1311

1412
# Add a RHEL 8 builder to compile the RHEL 8 compatible binaries
1513
FROM registry.ci.openshift.org/ocp/builder:rhel-8-golang-1.24-openshift-4.21 AS rhel8-builder
@@ -19,15 +17,12 @@ WORKDIR /go/src/github.com/openshift/machine-config-operator
1917
COPY . .
2018
ENV GOCACHE="/go/rhel8/.cache"
2119
ENV GOMODCACHE="/go/rhel8/pkg/mod"
22-
RUN --mount=type=cache,target=/go/rhel8/.cache,z \
23-
--mount=type=cache,target=/go/rhel8/pkg/mod,z \
24-
make install DESTDIR=./instroot-rhel8 && tar -C instroot-rhel8 -cf instroot-rhel8.tar .
20+
RUN make install DESTDIR=./instroot-rhel8 && tar -C instroot-rhel8 -cf instroot-rhel8.tar .
2521

2622
FROM registry.ci.openshift.org/ocp/4.21:base-rhel9
2723
ARG TAGS=""
2824
COPY install /manifests
29-
RUN --mount=type=cache,target=/var/cache/dnf,z \
30-
if [ "${TAGS}" = "fcos" ]; then \
25+
RUN if [ "${TAGS}" = "fcos" ]; then \
3126
# comment out non-base/extensions image-references entirely for fcos
3227
sed -i '/- name: rhel-coreos-/,+3 s/^/#/' /manifests/image-references && \
3328
# 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)

Dockerfile.rhel7

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,7 @@ COPY . .
88
# just use that. For now we work around this by copying a tarball.
99
ENV GOCACHE="/go/rhel9/.cache"
1010
ENV 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
1614
FROM 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
2018
COPY . .
2119
ENV GOCACHE="/go/rhel8/.cache"
2220
ENV 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

2723
FROM registry.ci.openshift.org/ocp/4.21:base-rhel9
2824
ARG TAGS=""
2925
COPY 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.
5046
COPY --from=rhel9-builder /go/src/github.com/openshift/machine-config-operator/instroot-rhel9.tar /tmp/instroot-rhel9.tar
5147
RUN cd / && tar xf /tmp/instroot-rhel9.tar && rm -f /tmp/instroot-rhel9.tar

0 commit comments

Comments
 (0)