datamade / how-to

📚 Doing all sorts of things, the DataMade way
MIT License
84 stars 12 forks source link

Investigate building images via GitHub Actions and configuring Heroku to deploy from those images, rather than duplicate build steps across services #153

Open hancush opened 3 years ago

hancush commented 3 years ago

Background

tk

Proposal

tk

Deliverables

tk

Timeline

tk

hancush commented 3 years ago

On deck for spring. Potentially impacts local development, as well.

fgregg commented 3 years ago

For a personal project, I used the github container service to significantly speed up CI. It was a good experience!

By default, the "docker/build-push-action" looks for a Dockerfile in the root directory. If it finds it, it builds the image and pushes it to github's newish container service ghcr.io. It only does this on tagged commits.

https://github.com/fgregg/knoxville_utility_burden/blob/main/.github/workflows/publish_docker.yml

To do this currently, you need to Enable improved container support.

fgregg commented 3 years ago

For private repos, if we were pulling this from outside the GH universe, you would need to login with a github personal authentication token, but that's a secret we can set in Heroku's environment

hancush commented 2 years ago

From what I can tell, Heroku doesn't allow you to deploy apps from external container registries. You can either build your image on deploy from a Dockerfile co-located with the code (our current paradigm), or push your image/s to the Heroku container registry. One huge downside to the latter strategy is that we'd no longer get review apps, which have been hugely beneficial to our productivity.

hancush commented 2 years ago

Great pattern suggestion from @fgregg: Have a primary Dockerfile that builds the image for GitHub, then a Heroku Dockerfile that just inherits from the existing image FROM ghci.io/${REPOSITORY}/${IMAGE}.