Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

exit with non-zero status code when hash mismatch #240

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

sudo-barun
Copy link

In case the hash does not match, exiting with non-zero value is useful during docker build.

For the following Dockerfile, the error during docker build occurs at the line RUN php composer-setup.php

# ...
RUN php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');"
RUN php -r "if (hash_file('sha384', 'composer-setup.php') === 'dac665fdc30fdd8ec78b38b9800061b4150413ff2e3b6f88543c636f7cd84f6db9189d43a81e5503cda447da73c7e5b6') { echo 'Installer verified'; } else { echo 'Installer corrupt'; unlink('composer-setup.php'); } echo PHP_EOL;"
RUN php composer-setup.php
RUN php -r "unlink('composer-setup.php');"
# ...

After this update, docker build fails at the previous line: RUN php -r "if (hash_file('sha384', 'composer-setup.php') === 'dac665....

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant