Running forgejo CI/CD build pipeline. The action mix phx.gen.release –docker frequently fails with 504 from hub.docker.com. This is trying to fetch a json file with a URL like the following to find the correct image to use in the build:-
What is the best workaround? Create a proxy to the internet to cache successful answers from hub.docker.com ? Allow a command line option for phx.gen.release to specify the image to use so that remote calls are not made?
I’ve run into this a few times myself. I had built out a prototype of filtering through these Docker Hub images as a web UI but what I found is that the Docker Hub API is incredibly non-performant combined with the sheer number of tags inside hexpm/elxir.
I’d almost prefer a sentinel value stored somewhere that could be just updated manually as necessary. A TXT DNS record, a plain text file on the Phoenix website, etc.
It really is remarkably slow when it works at all. It’s not an intermittent thing; it’s just busted all the time. Idk if there’s any way to fix it without operating a service to cache the value, though. Maybe rig something up with Actions/Pages? I assume the versions don’t change that often.
Have you considered running that mix task on your development environment once and committing the resulting files to git?
I believe that’s the intent of that task, as it generates some files you can customize, the Dockerfile included. This task is similar to generating a migration file or scaffolding a new controller, etc, such that typical use is not part of the CI/CD workflow (the usage in the Phoenix repository tests is not typical).
Once you commit your Dockerfile, then deploying the app builds it off a known base image that only changes when you explicitly update it.
That definitely is the intent, but it’s still unfortunate that the task is so slow/flaky. It means that new users are quite likely to see the command fail when they try to run it.
Thinking about it more, a repo under the Phoenix org with a simple Action that pings the API every hour and caches the results by uploading them to Pages would be an easy no-maintenance solution. Just point the task at the pages URL by default.