Skip to content

Commit c85c69d

Browse files
containers/ws: improve caching for incremental builds
When iterating locally it helps if we can avoid having to repeat the "download the packages from the Fedora servers" step, which is currently run every time. We can do that by separating it to a separate step that runs *before* we copy in the entire contents of what becomes the /container directory (which changes on every iteration). We install cockpit-bridge and cockpit-ws up front now even though they will still be installed later by install.sh because we want the dependencies (and I couldn't find any easy way to say "just install the runtime dependencies of these packages). We don't bother with any "layer avoidance" techniques here because this is just the builder container which doesn't become part of the final result.
1 parent 6605f3f commit c85c69d

File tree

2 files changed

+20
-5
lines changed

2 files changed

+20
-5
lines changed

containers/ws/Containerfile

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,26 @@ LABEL maintainer="cockpit-devel@lists.fedorahosted.org"
33
LABEL VERSION=main
44

55
ARG VERSION
6-
ADD . /container
76

7+
# This goes into the builder container
8+
RUN dnf install -y 'dnf-command(download)' cpio
9+
10+
# This goes into the final container. The cockpit- packages can be replaced
11+
# with local builds by the install.sh script later.
12+
RUN dnf install -y \
13+
--installroot=/build \
14+
--setopt=install_weak_deps=False \
15+
--use-host-config \
16+
cockpit-bridge \
17+
cockpit-ws \
18+
coreutils-single \
19+
openssh-clients \
20+
sed \
21+
sscg \
22+
util-linux-core \
23+
;
24+
25+
ADD . /container
826
RUN /container/install.sh
927

1028
FROM scratch

containers/ws/install.sh

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ set -ex
44

55
OSVER=$(. /etc/os-release && echo "$VERSION_ID")
66
INSTALLROOT=/build
7-
INSTALL="dnf install -y --installroot=$INSTALLROOT --releasever=$OSVER --setopt=install_weak_deps=False --use-host-config"
7+
INSTALL="dnf install -y --installroot=$INSTALLROOT --setopt=install_weak_deps=False --use-host-config"
88

99
# keep in sync with test/ws-container.install
1010
PACKAGES="
@@ -21,9 +21,6 @@ EXTERNAL_COCKPIT_PACKAGES="
2121
cockpit-files
2222
"
2323

24-
dnf install -y 'dnf-command(download)' cpio
25-
$INSTALL coreutils-single util-linux-core sed sscg python3 openssh-clients
26-
2724
arch=`uname -p`
2825
rpm=$(ls /container/rpms/cockpit-ws-*$OSVER.*$arch.rpm /container/rpms/cockpit-bridge-*$OSVER.*$arch.rpm || true)
2926

0 commit comments

Comments
 (0)