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

ci: cache docker buildx job #300

Merged
merged 1 commit into from
Feb 13, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 16 additions & 10 deletions .github/workflows/docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ permissions:
contents: read

jobs:
build:
build_and_deploy:
runs-on: ubuntu-latest

steps:
Expand All @@ -27,18 +27,24 @@ jobs:
uses: docker/setup-buildx-action@v3

# disable push on merge requests
- name: Test Build
uses: docker/build-push-action@v6
if: ${{ github.event_name == 'pull_request' }}
with:
push: false
platforms: linux/amd64,linux/arm64
tags: steelscheme/steel:latest

- name: Build and push the docker image
# - name: Build docker image (Pull Request)
# uses: docker/build-push-action@v6
# if: ${{ github.event_name == 'pull_request' }}
# with:
# push: false
# platforms: linux/amd64,linux/arm64
# tags: steelscheme/steel:latest
# # cache-from: type=gha
# # cache-to: type=gha,mode=max
# cache-from: type=registry,ref=steelscheme/steel:buildcache
# cache-to: type=registry,ref=steelscheme/steel:buildcache,mode=max

- name: Build & publish the docker image
Comment on lines +30 to +42
Copy link
Owner

Choose a reason for hiding this comment

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

Can we remove this commented step?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I wish to re-enable it once i make sure caching works.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It is build job job builds only on pull requests. I will also configure it to run only on changes to Dockerfile conditionally in next PR

uses: docker/build-push-action@v6
if: ${{ github.event_name != 'pull_request' }}
with:
push: true
platforms: linux/amd64,linux/arm64
tags: steelscheme/steel:latest
cache-from: type=registry,ref=steelscheme/steel:buildcache
cache-to: type=registry,ref=steelscheme/steel:buildcache,mode=max
Loading