Skip to content
Open
Show file tree
Hide file tree
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
36 changes: 36 additions & 0 deletions .github/actions/docker-build/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
name: Build and push Docker Image
description: Build and push the docker image. Save cache to registry with configurable values
inputs:
github-token:
description: The GITHUB_TOKEN
required: true
cache-from-ref:
description: Where to get the cache from (passed to the build and push action)

runs:
using: composite
steps:
- name: Login to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ inputs.github-token }}

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v4

- name: Get image metadata
id: meta
uses: docker/metadata-action@v5
with:
images: ghcr.io/${{ github.repository }}

- name: Build and push Docker image for the web app
uses: docker/build-push-action@v6
with:
context: .
push: true
tags: ${{ steps.meta.outputs.tags }}
cache-from: type=registry,ref=${{ inputs.cache-from-ref || steps.meta.outputs.tags }}
cache-to: type=registry,ref=${{ steps.meta.outputs.tags }},mode=max
5 changes: 5 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,3 +51,8 @@ jobs:
- name: Check that documentation builds cleanly with MkDocs
if: matrix.os == 'ubuntu-latest'
run: mkdocs build --strict

- name: Test Docker build
uses: ./.github/actions/docker-build
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
23 changes: 5 additions & 18 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,22 +15,9 @@ jobs:
steps:
- name: Checkout
uses: actions/checkout@v6
- name: Login to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Get image metadata
id: meta
uses: docker/metadata-action@v5
with:
images: ghcr.io/${{ github.repository }}
- name: Build and push Docker image for the web app
uses: docker/build-push-action@v6

- name: Test Docker build
uses: ./.github/actions/docker-build
with:
context: .
push: true
tags: ${{ steps.meta.outputs.tags }}
cache-from: type=registry,ref=${{ steps.meta.outputs.tags }}
cache-to: type=inline
github-token: ${{ secrets.GITHUB_TOKEN }}
cache-from-ref: ghcr.io/${{ github.repository }}:main
Loading