A technical solution is the last thing you want: if you implement a "perfect" technical solution then it removes your feeling of responsibility to try. What you need is the skills to be able to resist the behavior you want to not do. Things like therapy, meditation, CBT may help.
Not all technical solutions are bad. If you're an alcoholic don't get a job in a liquor store. But there's always going to be times you need strategies to make the right decisions.