forked from rojopolis/spellcheck-github-actions
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Use the `docker/build-push` and `docker/metadata` actions to build a container and add the proper tag depending on the branch, PR or the tagged version using semver as the proper version. Closes rojopolis#80 Signed-off-by: Jonathan Gonzalez V <[email protected]>
- Loading branch information
Showing
1 changed file
with
42 additions
and
4 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,14 +2,52 @@ name: Docker Image CI | |
|
||
on: [push, pull_request] | ||
|
||
env: | ||
REGISTRY: ghcr.io | ||
IMAGE_NAME: ${{ github.repository }} | ||
|
||
jobs: | ||
|
||
docker-build: | ||
|
||
runs-on: ubuntu-latest | ||
|
||
permissions: | ||
contents: read | ||
packages: write | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
- name: Build the Docker image | ||
run: docker build . --file Dockerfile --tag spellcheck:$(date +%s) | ||
|
||
- name: Set up QEMU | ||
uses: docker/[email protected] | ||
with: | ||
image: tonistiigi/binfmt:qemu-v6.2.0 | ||
|
||
- name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v1 | ||
with: | ||
install: true | ||
|
||
- name: Login to GitHub Registry | ||
uses: docker/[email protected] | ||
with: | ||
registry: ${{ env.REGISTRY }} | ||
username: ${{ github.repository_owner }} | ||
password: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- name: Metadata for the image | ||
id: meta | ||
uses: docker/[email protected] | ||
with: | ||
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} | ||
tags: | | ||
type=ref,event=branch | ||
type=ref,event=pr | ||
type=semver,pattern={{version} | ||
- name: Build container | ||
uses: docker/[email protected] | ||
with: | ||
platforms: "linux/amd64, linux/arm64" | ||
context: . | ||
push: true | ||
tags: ${{ steps.meta.outputs.tags }} |