Created
October 17, 2024 09:12
-
-
Save mec/398c12805c77ce4c5d4949887497beb3 to your computer and use it in GitHub Desktop.
Basic build and cache CI job
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: CI Checks | |
on: | |
pull_request: | |
push: | |
branches: | |
- main | |
jobs: | |
build-and-cache: | |
name: Build and cache image | |
runs-on: ubuntu-latest | |
steps: | |
- | |
name: Checkout | |
uses: actions/checkout@v4 | |
- | |
name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
- | |
name: Build and cache | |
uses: docker/build-push-action@v6 | |
with: | |
context: . | |
file: ./Dockerfile | |
build-args: RAILS_ENV=test | |
push: false | |
tags: app:latest | |
cache-from: type=gha | |
cache-to: type=gha,mode=min |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
push
is set to false because a later job pushes the image but the built image remains in context for subsequent builds which will happen very quickly.