Skip to content
This repository was archived by the owner on May 24, 2024. It is now read-only.

Commit d1ade2c

Browse files
authored
Merge pull request #489 from cgwalters/rework-buildcontext-copy
build-sys: Sync Containerfiles
2 parents c9fc7d6 + 9ee47bd commit d1ade2c

File tree

3 files changed

+23
-5
lines changed

3 files changed

+23
-5
lines changed

Containerfile.centos-stream10

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,20 @@ ARG MANIFEST=centos-stream-10-tier1.yaml
77
RUN --mount=type=bind,rw=true,src=.,dst=/buildcontext,bind-propagation=shared rm -vf /buildcontext/*.repo
88
# XXX: we should just make sure our in-tree c9s repo points to the c9s paths and doesn't require vars to avoid these steps entirely
99
COPY --from=repos /etc/dnf/vars /etc/dnf/vars
10+
# The input git repository has .repo files committed to git rpm-ostree has historically
11+
# emphasized that. But here, we are fetching the repos from the container base image.
12+
# So copy the source, and delete the hardcoded ones in git, and use the container base
13+
# image ones. We can drop the ones commited to git when we hard switch to Containerfile.
14+
COPY . /src
15+
WORKDIR /src
16+
RUN rm -vf /src/*.repo
1017
COPY --from=repos /etc/yum.repos.d/centos.repo c10s.repo
1118
COPY --from=repos /etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial /etc/pki/rpm-gpg
1219
# rpm-ostree doesn't honor /etc/dnf/vars right now
1320
RUN for n in $(ls /etc/dnf/vars); do v=$(cat /etc/dnf/vars/$n); sed -ie s,\$${n},$v, c10s.repo; done
1421
RUN --mount=type=cache,target=/workdir --mount=type=bind,rw=true,src=.,dst=/buildcontext,bind-propagation=shared \
15-
cp -a /buildcontext /src && rm -vf /src/*.repo && cp -a c10s.repo /src && ls -al /src && \
16-
rpm-ostree compose image --image-config /buildcontext/centos-bootc-config.json \
17-
--cachedir=/workdir --format=ociarchive --initialize /src/${MANIFEST} /buildcontext/out.ociarchive
22+
rpm-ostree compose image --image-config centos-bootc-config.json \
23+
--cachedir=/workdir --format=ociarchive --initialize ${MANIFEST} /buildcontext/out.ociarchive
1824

1925
FROM oci-archive:./out.ociarchive
2026
# Need to reference builder here to force ordering. But since we have to run

Containerfile.centos-stream9

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,12 +29,19 @@ FROM quay.io/centos-bootc/bootc-image-builder:latest as builder
2929
ARG MANIFEST=centos-stream-9-tier1.yaml
3030
# XXX: we should just make sure our in-tree c9s repo points to the c9s paths and doesn't require vars to avoid these steps entirely
3131
COPY --from=repos /etc/dnf/vars /etc/dnf/vars
32+
# The input git repository has .repo files committed to git rpm-ostree has historically
33+
# emphasized that. But here, we are fetching the repos from the container base image.
34+
# So copy the source, and delete the hardcoded ones in git, and use the container base
35+
# image ones. We can drop the ones commited to git when we hard switch to Containerfile.
36+
COPY . /src
37+
WORKDIR /src
38+
RUN rm -vf /src/*.repo
3239
COPY --from=repos /etc/yum.repos.d/centos.repo c9s.repo
3340
COPY --from=repos /etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial /etc/pki/rpm-gpg
3441
# rpm-ostree doesn't honor /etc/dnf/vars right now
3542
RUN for n in $(ls /etc/dnf/vars); do v=$(cat /etc/dnf/vars/$n); sed -ie s,\$${n},$v, c9s.repo; done
3643
RUN --mount=type=cache,target=/workdir --mount=type=bind,rw=true,src=.,dst=/buildcontext,bind-propagation=shared \
37-
rpm-ostree compose image --image-config /buildcontext/centos-bootc-config.json --cachedir=/workdir --format=ociarchive --initialize /buildcontext/${MANIFEST} /buildcontext/out.ociarchive
44+
rpm-ostree compose image --image-config centos-bootc-config.json --cachedir=/workdir --format=ociarchive --initialize ${MANIFEST} /buildcontext/out.ociarchive
3845

3946
FROM oci-archive:./out.ociarchive
4047
# Need to reference builder here to force ordering. But since we have to run

Containerfile.fedora-40

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,11 +29,16 @@ FROM quay.io/centos-bootc/bootc-image-builder:latest as builder
2929
ARG MANIFEST=fedora-bootc.yaml
3030
COPY --from=repos /etc/dnf/vars /etc/dnf/vars
3131
COPY --from=repos /etc/pki/rpm-gpg/RPM-GPG-KEY-fedora-* /etc/pki/rpm-gpg
32+
# The input git repository has .repo files committed to git rpm-ostree has historically
33+
# emphasized that. But here, we are fetching the repos from the container base image.
34+
# So copy the source, and delete the hardcoded ones in git, and use the container base
35+
# image ones. We can drop the ones commited to git when we hard switch to Containerfile.
3236
COPY . /src
37+
WORKDIR /src
3338
RUN rm -vf /src/*.repo
3439
COPY --from=repos /etc/yum.repos.d/*.repo /src
3540
RUN --mount=type=cache,target=/workdir --mount=type=bind,rw=true,src=.,dst=/buildcontext,bind-propagation=shared rpm-ostree compose image \
36-
--image-config /buildcontext/fedora-bootc-config.json --cachedir=/workdir --format=ociarchive --initialize /src/${MANIFEST} /buildcontext/out.ociarchive
41+
--image-config fedora-bootc-config.json --cachedir=/workdir --format=ociarchive --initialize ${MANIFEST} /buildcontext/out.ociarchive
3742

3843
FROM oci-archive:./out.ociarchive
3944
# Need to reference builder here to force ordering. But since we have to run

0 commit comments

Comments
 (0)