FYI: Downloading and verifying latest exiftool within Docker (or a shell script)

Started by marco-schmidt, September 10, 2020, 06:23:51 PM

Previous topic - Next topic

marco-schmidt

I've recently created a Dockerfile that bundles my application with exiftool in a Docker image. This makes use of typical Unix tools and could be used within any shell script.

  • It determines the most recent version of exiftool by downloading the ver.txt file,
  • downloads that version,
  • downloads the checksums.txt file and
  • verifies the downloaded archive against the expected checksum, stopping if it does not match.

None of that is particularly difficult, but it took me some time getting the details right. Here are the relevant parts, which might save someone the effort trying to do the same thing (I couldn't find this elsewhere):
  && mkdir -p /opt/exiftool \
  && cd /opt/exiftool \
  && EXIFTOOL_VERSION=`curl -s https://exiftool.org/ver.txt` \
  && EXIFTOOL_ARCHIVE=Image-ExifTool-${EXIFTOOL_VERSION}.tar.gz \
  && curl -s -O https://exiftool.org/$EXIFTOOL_ARCHIVE \
  && CHECKSUM=`curl -s https://exiftool.org/checksums.txt | grep SHA1\(${EXIFTOOL_ARCHIVE} | awk -F'= ' '{print $2}'` \
  && echo "${CHECKSUM}  ${EXIFTOOL_ARCHIVE}" | /usr/bin/sha1sum -c -s - \
  && tar xzf $EXIFTOOL_ARCHIVE --strip-components=1 \
  && rm -f $EXIFTOOL_ARCHIVE \
  && exiftool -ver \

https://github.com/marco-schmidt/am/blob/c5b7904cdd1629f08caac09e90f0f53a2393ca1b/Dockerfile#L30

Feel free to use this and please comment on any improvements you might see.

To Phil and everyone contributing to exiftool, thank you so much for all your work. I appreciate it very much.

Greetings,
Marco

Phil Harvey

...where DIR is the name of a directory/folder containing the images.  On Mac/Linux, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).