Verify packer checksum and signature

This commit is contained in:
Simon Bruder 2019-11-01 12:56:09 +00:00
parent cee9979679
commit b80b030d36
No known key found for this signature in database
GPG key ID: 6F03E0000CC5B62F
2 changed files with 51 additions and 4 deletions

View file

@ -2,6 +2,8 @@ FROM docker
RUN apk add --no-cache \
ca-certificates \
coreutils \
gnupg \
libffi \
mktorrent \
openssh-client \
@ -22,10 +24,24 @@ RUN apk add --no-cache \
ARG PACKER_VERSION
RUN mkdir -p /usr/local/bin \
&& wget -O /tmp/packer.zip -c https://releases.hashicorp.com/packer/${PACKER_VERSION}/packer_${PACKER_VERSION}_linux_amd64.zip \
&& unzip /tmp/packer.zip -d /usr/local/bin \
&& rm -f /tmp/packer.zip \
COPY hashicorp.asc /usr/local/share/
RUN gpg --import /usr/local/share/hashicorp.asc \
&& mkdir -p \
/usr/local/bin \
/tmp/packer \
&& (cd /tmp/packer \
&& wget --no-verbose \
https://releases.hashicorp.com/packer/${PACKER_VERSION}/packer_${PACKER_VERSION}_linux_amd64.zip \
https://releases.hashicorp.com/packer/${PACKER_VERSION}/packer_${PACKER_VERSION}_SHA256SUMS \
https://releases.hashicorp.com/packer/${PACKER_VERSION}/packer_${PACKER_VERSION}_SHA256SUMS.sig \
&& gpg --verify \
packer_${PACKER_VERSION}_SHA256SUMS.sig \
packer_${PACKER_VERSION}_SHA256SUMS \
&& sha256sum -c --strict --ignore-missing packer_${PACKER_VERSION}_SHA256SUMS | grep -F "packer_${PACKER_VERSION}_linux_amd64.zip: OK" \
&& unzip *.zip -d /usr/local/bin \
&& rm -f /tmp/packer.zip \
) \
&& mkdir /workdir
WORKDIR /workdir
@ -33,3 +49,4 @@ WORKDIR /workdir
COPY entrypoint.sh /usr/local/bin/entrypoint.sh
ENTRYPOINT ["/usr/local/bin/entrypoint.sh"]
# vim: ts=4 sw=4 sts=4 noet: