Zorglub29
Zorglub29

Reputation: 8801

Should I / how to retrieve miniconda installer SHA256 programatically?

I am setting up a Containerfile that should install miniconda.

The instructions for installing miniconda are available at: https://docs.conda.io/projects/conda/en/latest/user-guide/install/linux.html .

I am able to get the installer from https://docs.anaconda.com/miniconda/ as:

RUN wget --https-only https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh
RUN bash Miniconda3-latest-Linux-x86_64.sh -b

However, one thing is missing here: checking the SHA256 hash of the .sh installer. I know where the SHA is (it is on https://docs.anaconda.com/miniconda/ ), however, I do not see a simple way to retrieve it programatically.

Any idea how I can do this?

Upvotes: 0

Views: 60

Answers (1)

Jesuisme
Jesuisme

Reputation: 1911

A solution would be to download the Miniconda hashes to a file, then see if the hash you generated is in the file.

The SHA-256 hashes for Miniconda are located at:

https://repo.anaconda.com/miniconda/

So, the Docker commands would be:

RUN wget -O miniconda_hashes.html "https://repo.anaconda.com/miniconda/"
RUN checksum_string=$(bash Miniconda3-latest-Linux-x86_64.sh -b)
RUN if grep -q "$checksum_string" miniconda_hashes.html; then \
        echo "Miniconda checksum verified." ; \
    else \
        echo "Miniconda checksum was not verified. Exiting." && exit 1; \
    fi

Upvotes: 1

Related Questions