Docker install package with checksum check

2024.07.19
# fix CVE-2023-45853
ENV PACKAGE_URL=http://archive.ubuntu.com/ubuntu/pool/main/z/zlib/zlib1g-dev_1.3.dfsg-3.1ubuntu2_amd64.deb
ENV PACKAGE_SHA256=7360405fbf49e35dca2f7a4ebeac7d4fe5fe3b2db99adac70e11e104f53b2642

# Download the fixed package, verify its checksum, and install it
RUN wget ${PACKAGE_URL} -O /tmp/fixed-package.deb && \
    echo "${PACKAGE_SHA256} /tmp/fixed-package.deb" | sha256sum -c - && \
    dpkg -i /tmp/fixed-package.deb && \
    rm /tmp/fixed-package.deb && \
    exit 1