Can CiviDiscount be used on a Contribution Page without Membership
Here is a proof-of-concept extension that shows how to override bits of CiviDiscount to make it possible. It might be better to fix this in CiviDiscount itself, but meanwhile it's a good way to test and better define the requirements.

https://lab.civicrm.org/extensions/discountcontributions

This is copy-pasted code from a project. I tried to package it as an extension so that it can be re-usable, but I have not tested it at all. If you find it useful, please contribute to it. There are hardcoded Contribution Page IDs and PriceSet IDs, which should be converted to settings.