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

[minor] optimize docker pulls when action is executed #74

Merged
merged 1 commit into from
Oct 9, 2024

Conversation

joemiller
Copy link
Member

@joemiller joemiller commented Oct 9, 2024

When a docker-based github-action is run in a workflow, github pulls the repo and then builds an image from the Dockerfile every time. In our case this involves downloading and installing some apk packages. We can pre-bake this image and save some bandwidth and time.

  1. Moved the release job out of the ci.yaml workflow and into a new release.yaml GHA workflow. Release runs only on main merges.
  2. New Dockerfile.base contains all of the apk dependencies. It creates the runtime image
  3. Release workflow builds Dockerfile.base and pushes to ghcr.io/planetscale/ghcommit-action:v${new_version}. autotag is still used to calculate the $new_version.
  4. Release workflow updates the version in Dockerfile and commits back to the main branch.

The runtime Dockerfile is now a 1-liner referencing ghcr.io/planetscale/ghcommit-action:v${new_version}'

This commit contains [minor] in the commit message which will trigger autotag to increment the minor version. This will be the start of v0.2.0.

@joemiller joemiller marked this pull request as ready for review October 9, 2024 02:27
@joemiller joemiller requested a review from a team as a code owner October 9, 2024 02:27
@joemiller joemiller marked this pull request as draft October 9, 2024 02:27
@joemiller joemiller force-pushed the joem/optimize-image-pull branch 3 times, most recently from c79bcf3 to 1657eb8 Compare October 9, 2024 02:28
@joemiller joemiller marked this pull request as ready for review October 9, 2024 02:34
@joemiller joemiller force-pushed the joem/optimize-image-pull branch 2 times, most recently from 5dd11a6 to db4b5cb Compare October 9, 2024 02:36
@joemiller joemiller marked this pull request as draft October 9, 2024 02:37
@joemiller joemiller force-pushed the joem/optimize-image-pull branch 12 times, most recently from 25d4404 to 03fc449 Compare October 9, 2024 03:14
@@ -3,7 +3,7 @@ name: ci
on:
push:
branches:
- "*"
- '**'
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TIL - * will run on all branches not containing /, and ** will run on all branches
https://stackoverflow.com/a/57903434/886537

@joemiller joemiller changed the title wip: experiment [minor] optimize docker pulls when action is executed Oct 9, 2024
@joemiller joemiller marked this pull request as ready for review October 9, 2024 03:30
@joemiller joemiller force-pushed the joem/optimize-image-pull branch 3 times, most recently from 787cebe to 14d24cd Compare October 9, 2024 04:20
Copy link

@JTCunning JTCunning left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🍪

@joemiller joemiller merged commit 463cae3 into main Oct 9, 2024
2 checks passed
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.

2 participants