Message ID | 20230216134847.495137-1-dceara@redhat.com |
---|---|
State | Rejected |
Headers | show |
Series | [ovs-dev] ci: ovn-kubernetes: Reduce image size. | expand |
Context | Check | Description |
---|---|---|
ovsrobot/apply-robot | success | apply and check: success |
ovsrobot/github-robot-_Build_and_Test | success | github build: passed |
ovsrobot/github-robot-_ovn-kubernetes | fail | github build: failed |
On Thu, Feb 16, 2023 at 2:48 PM Dumitru Ceara <dceara@redhat.com> wrote: > Remove some packages that we don't need in the final image (and also > remove dnf cache). Also squash the container image layers in CI. > > This saves approximately 800MB of image size. > > Signed-off-by: Dumitru Ceara <dceara@redhat.com> > --- > .ci/ovn-kubernetes/Dockerfile | 7 +++++-- > .github/workflows/ovn-kubernetes.yml | 2 +- > 2 files changed, 6 insertions(+), 3 deletions(-) > > diff --git a/.ci/ovn-kubernetes/Dockerfile b/.ci/ovn-kubernetes/Dockerfile > index 722af78709..0a958cc81e 100644 > --- a/.ci/ovn-kubernetes/Dockerfile > +++ b/.ci/ovn-kubernetes/Dockerfile > @@ -66,8 +66,7 @@ FROM fedora:37 > # install needed dependencies > RUN INSTALL_PKGS=" \ > iptables iproute iputils hostname unbound-libs kubernetes-client kmod > socat" && \ > - dnf install --best --refresh -y --setopt=tsflags=nodocs $INSTALL_PKGS > && \ > - dnf clean all && rm -rf /var/cache/dnf/* > + dnf install --best --refresh -y --setopt=tsflags=nodocs $INSTALL_PKGS > > RUN mkdir -p /var/run/openvswitch > > @@ -90,6 +89,10 @@ COPY --from=ovnkubebuilder > /root/ovn-kubernetes/dist/images/ovnkube.sh /root/ > COPY --from=ovnkubebuilder > /root/ovn-kubernetes/dist/images/ovndb-raft-functions.sh /root/ > COPY --from=ovnkubebuilder > /root/ovn-kubernetes/dist/images/iptables-scripts /usr/sbin/ > > +# Make some room. > +RUN REMOVE_PKGS="llvm-libs clang-libs" && \ > + dnf remove -y $REMOVE_PKGS && dnf clean all && rm -rf /var/cache/dnf/* > + > LABEL io.k8s.display-name="ovn-kubernetes" \ > io.k8s.description="This is a Kubernetes network plugin that provides > an overlay network using OVN." \ > maintainer="ovn team" > diff --git a/.github/workflows/ovn-kubernetes.yml > b/.github/workflows/ovn-kubernetes.yml > index 8a7815f1dd..d65f0fc5c1 100644 > --- a/.github/workflows/ovn-kubernetes.yml > +++ b/.github/workflows/ovn-kubernetes.yml > @@ -38,7 +38,7 @@ jobs: > run: | > docker build --build-arg OVNKUBE_COMMIT=${{ env.OVNKUBE_COMMIT }} > \ > --build-arg LIBOVSDB_COMMIT=${{ env.LIBOVSDB_COMMIT }} \ > - -t ovn-daemonset-f:dev -f .ci/ovn-kubernetes/Dockerfile . > + --squash -t ovn-daemonset-f:dev -f > .ci/ovn-kubernetes/Dockerfile . > mkdir /tmp/_output > docker save ovn-daemonset-f:dev > /tmp/_output/image.tar > > -- > 2.31.1 > > Great improvement, thanks! Acked-by: Ales Musil <amusil@redhat.com>
On 2/16/23 14:53, Ales Musil wrote: > On Thu, Feb 16, 2023 at 2:48 PM Dumitru Ceara <dceara@redhat.com> wrote: > >> Remove some packages that we don't need in the final image (and also >> remove dnf cache). Also squash the container image layers in CI. >> >> This saves approximately 800MB of image size. >> >> Signed-off-by: Dumitru Ceara <dceara@redhat.com> >> --- >> .ci/ovn-kubernetes/Dockerfile | 7 +++++-- >> .github/workflows/ovn-kubernetes.yml | 2 +- >> 2 files changed, 6 insertions(+), 3 deletions(-) >> >> diff --git a/.ci/ovn-kubernetes/Dockerfile b/.ci/ovn-kubernetes/Dockerfile >> index 722af78709..0a958cc81e 100644 >> --- a/.ci/ovn-kubernetes/Dockerfile >> +++ b/.ci/ovn-kubernetes/Dockerfile >> @@ -66,8 +66,7 @@ FROM fedora:37 >> # install needed dependencies >> RUN INSTALL_PKGS=" \ >> iptables iproute iputils hostname unbound-libs kubernetes-client kmod >> socat" && \ >> - dnf install --best --refresh -y --setopt=tsflags=nodocs $INSTALL_PKGS >> && \ >> - dnf clean all && rm -rf /var/cache/dnf/* >> + dnf install --best --refresh -y --setopt=tsflags=nodocs $INSTALL_PKGS >> >> RUN mkdir -p /var/run/openvswitch >> >> @@ -90,6 +89,10 @@ COPY --from=ovnkubebuilder >> /root/ovn-kubernetes/dist/images/ovnkube.sh /root/ >> COPY --from=ovnkubebuilder >> /root/ovn-kubernetes/dist/images/ovndb-raft-functions.sh /root/ >> COPY --from=ovnkubebuilder >> /root/ovn-kubernetes/dist/images/iptables-scripts /usr/sbin/ >> >> +# Make some room. >> +RUN REMOVE_PKGS="llvm-libs clang-libs" && \ >> + dnf remove -y $REMOVE_PKGS && dnf clean all && rm -rf /var/cache/dnf/* >> + >> LABEL io.k8s.display-name="ovn-kubernetes" \ >> io.k8s.description="This is a Kubernetes network plugin that provides >> an overlay network using OVN." \ >> maintainer="ovn team" >> diff --git a/.github/workflows/ovn-kubernetes.yml >> b/.github/workflows/ovn-kubernetes.yml >> index 8a7815f1dd..d65f0fc5c1 100644 >> --- a/.github/workflows/ovn-kubernetes.yml >> +++ b/.github/workflows/ovn-kubernetes.yml >> @@ -38,7 +38,7 @@ jobs: >> run: | >> docker build --build-arg OVNKUBE_COMMIT=${{ env.OVNKUBE_COMMIT }} >> \ >> --build-arg LIBOVSDB_COMMIT=${{ env.LIBOVSDB_COMMIT }} \ >> - -t ovn-daemonset-f:dev -f .ci/ovn-kubernetes/Dockerfile . >> + --squash -t ovn-daemonset-f:dev -f >> .ci/ovn-kubernetes/Dockerfile . >> mkdir /tmp/_output >> docker save ovn-daemonset-f:dev > /tmp/_output/image.tar >> >> -- >> 2.31.1 >> >> > Great improvement, thanks! > > Acked-by: Ales Musil <amusil@redhat.com> > Thanks for the quick review! I'll wait for the ovsrobot to take this patch for a spin first before applying it. Regards, Dumitru
On 2/16/23 14:55, Dumitru Ceara wrote: > On 2/16/23 14:53, Ales Musil wrote: >> On Thu, Feb 16, 2023 at 2:48 PM Dumitru Ceara <dceara@redhat.com> wrote: >> >>> Remove some packages that we don't need in the final image (and also >>> remove dnf cache). Also squash the container image layers in CI. >>> >>> This saves approximately 800MB of image size. >>> >>> Signed-off-by: Dumitru Ceara <dceara@redhat.com> >>> --- >>> .ci/ovn-kubernetes/Dockerfile | 7 +++++-- >>> .github/workflows/ovn-kubernetes.yml | 2 +- >>> 2 files changed, 6 insertions(+), 3 deletions(-) >>> >>> diff --git a/.ci/ovn-kubernetes/Dockerfile b/.ci/ovn-kubernetes/Dockerfile >>> index 722af78709..0a958cc81e 100644 >>> --- a/.ci/ovn-kubernetes/Dockerfile >>> +++ b/.ci/ovn-kubernetes/Dockerfile >>> @@ -66,8 +66,7 @@ FROM fedora:37 >>> # install needed dependencies >>> RUN INSTALL_PKGS=" \ >>> iptables iproute iputils hostname unbound-libs kubernetes-client kmod >>> socat" && \ >>> - dnf install --best --refresh -y --setopt=tsflags=nodocs $INSTALL_PKGS >>> && \ >>> - dnf clean all && rm -rf /var/cache/dnf/* >>> + dnf install --best --refresh -y --setopt=tsflags=nodocs $INSTALL_PKGS >>> >>> RUN mkdir -p /var/run/openvswitch >>> >>> @@ -90,6 +89,10 @@ COPY --from=ovnkubebuilder >>> /root/ovn-kubernetes/dist/images/ovnkube.sh /root/ >>> COPY --from=ovnkubebuilder >>> /root/ovn-kubernetes/dist/images/ovndb-raft-functions.sh /root/ >>> COPY --from=ovnkubebuilder >>> /root/ovn-kubernetes/dist/images/iptables-scripts /usr/sbin/ >>> >>> +# Make some room. >>> +RUN REMOVE_PKGS="llvm-libs clang-libs" && \ >>> + dnf remove -y $REMOVE_PKGS && dnf clean all && rm -rf /var/cache/dnf/* >>> + >>> LABEL io.k8s.display-name="ovn-kubernetes" \ >>> io.k8s.description="This is a Kubernetes network plugin that provides >>> an overlay network using OVN." \ >>> maintainer="ovn team" >>> diff --git a/.github/workflows/ovn-kubernetes.yml >>> b/.github/workflows/ovn-kubernetes.yml >>> index 8a7815f1dd..d65f0fc5c1 100644 >>> --- a/.github/workflows/ovn-kubernetes.yml >>> +++ b/.github/workflows/ovn-kubernetes.yml >>> @@ -38,7 +38,7 @@ jobs: >>> run: | >>> docker build --build-arg OVNKUBE_COMMIT=${{ env.OVNKUBE_COMMIT }} >>> \ >>> --build-arg LIBOVSDB_COMMIT=${{ env.LIBOVSDB_COMMIT }} \ >>> - -t ovn-daemonset-f:dev -f .ci/ovn-kubernetes/Dockerfile . >>> + --squash -t ovn-daemonset-f:dev -f >>> .ci/ovn-kubernetes/Dockerfile . >>> mkdir /tmp/_output >>> docker save ovn-daemonset-f:dev > /tmp/_output/image.tar >>> >>> -- >>> 2.31.1 >>> >>> >> Great improvement, thanks! >> >> Acked-by: Ales Musil <amusil@redhat.com> >> > > Thanks for the quick review! I'll wait for the ovsrobot to take this > patch for a spin first before applying it. > As a matter of fact it turns out that docker doesn't like "--squash" by default. We get this in GH CI: docker build --build-arg OVNKUBE_COMMIT=master \ "--squash" is only supported on a Docker daemon with experimental features enabled I was using podman locally. I'll see if I can make it work with docker too and post a v2. Sorry for the noise. Dumitru
diff --git a/.ci/ovn-kubernetes/Dockerfile b/.ci/ovn-kubernetes/Dockerfile index 722af78709..0a958cc81e 100644 --- a/.ci/ovn-kubernetes/Dockerfile +++ b/.ci/ovn-kubernetes/Dockerfile @@ -66,8 +66,7 @@ FROM fedora:37 # install needed dependencies RUN INSTALL_PKGS=" \ iptables iproute iputils hostname unbound-libs kubernetes-client kmod socat" && \ - dnf install --best --refresh -y --setopt=tsflags=nodocs $INSTALL_PKGS && \ - dnf clean all && rm -rf /var/cache/dnf/* + dnf install --best --refresh -y --setopt=tsflags=nodocs $INSTALL_PKGS RUN mkdir -p /var/run/openvswitch @@ -90,6 +89,10 @@ COPY --from=ovnkubebuilder /root/ovn-kubernetes/dist/images/ovnkube.sh /root/ COPY --from=ovnkubebuilder /root/ovn-kubernetes/dist/images/ovndb-raft-functions.sh /root/ COPY --from=ovnkubebuilder /root/ovn-kubernetes/dist/images/iptables-scripts /usr/sbin/ +# Make some room. +RUN REMOVE_PKGS="llvm-libs clang-libs" && \ + dnf remove -y $REMOVE_PKGS && dnf clean all && rm -rf /var/cache/dnf/* + LABEL io.k8s.display-name="ovn-kubernetes" \ io.k8s.description="This is a Kubernetes network plugin that provides an overlay network using OVN." \ maintainer="ovn team" diff --git a/.github/workflows/ovn-kubernetes.yml b/.github/workflows/ovn-kubernetes.yml index 8a7815f1dd..d65f0fc5c1 100644 --- a/.github/workflows/ovn-kubernetes.yml +++ b/.github/workflows/ovn-kubernetes.yml @@ -38,7 +38,7 @@ jobs: run: | docker build --build-arg OVNKUBE_COMMIT=${{ env.OVNKUBE_COMMIT }} \ --build-arg LIBOVSDB_COMMIT=${{ env.LIBOVSDB_COMMIT }} \ - -t ovn-daemonset-f:dev -f .ci/ovn-kubernetes/Dockerfile . + --squash -t ovn-daemonset-f:dev -f .ci/ovn-kubernetes/Dockerfile . mkdir /tmp/_output docker save ovn-daemonset-f:dev > /tmp/_output/image.tar
Remove some packages that we don't need in the final image (and also remove dnf cache). Also squash the container image layers in CI. This saves approximately 800MB of image size. Signed-off-by: Dumitru Ceara <dceara@redhat.com> --- .ci/ovn-kubernetes/Dockerfile | 7 +++++-- .github/workflows/ovn-kubernetes.yml | 2 +- 2 files changed, 6 insertions(+), 3 deletions(-)