pkgdiff icon indicating copy to clipboard operation
pkgdiff copied to clipboard

Running `pkgdiff` using docker

Open srbala opened this issue 3 years ago • 0 comments

This is more of notes, not an issue. can be added to the documentation. I had a requirement that needed run pkgdiff in jenkins step, and put together a Dockerfile for it. The community can use it too.

FROM fedora:36 as builder

ARG SYS_ROOT=/mnt/sys-root

RUN mkdir $SYS_ROOT; \
    dnf install \
    --installroot $SYS_ROOT \
    --releasever 36 \
    --nodocs -y \
    diffutils \
    gawk \
    perl-File-LibMagic \
    pkgdiff \
    wdiff \
    dpkg \
    binutils \
    tar \
    xz \
    gzip \
    which \
    java-17-openjdk-headless \
    abi-compliance-checker \
    abi-dumper; \
    dnf --installroot $SYS_ROOT clean all; 

# Some standard cleanup to reduce the size of image    
RUN rm -rf $SYS_ROOT/var/log/dnf* $SYS_ROOT/var/log/yum.* $SYS_ROOT/var/cache/dnf $SYS_ROOT/var/lib/dnf/repos; \
    rm -rf $SYS_ROOT/var/lib/dnf/history* $SYS_ROOT/var/log/hawkey.log $SYS_ROOT/boot $SYS_ROOT/dev/null $SYS_ROOT/run/*; \
    rm -f $SYS_ROOT/etc/machine-id; \
    touch $SYS_ROOT/etc/machine-id; \
    mkdir -p $SYS_ROOT/work

# Second stage build to reduce size
FROM scratch
COPY --from=builder /mnt/sys-root/ /

WORKDIR /work

ENTRYPOINT ["pkgdiff"]

CMD ["--help"]

Published image available at srbala/build-tools:pkgdiff from dockerhub.

docker pull srbala/build-tools:pkgdiff
docker run --privileged --rm -ti -v $PWD:/work srbala/build-tools:pkgdiff fileOld.tar.xz fileNew.tar.xz

srbala avatar Aug 09 '22 11:08 srbala