forked from EVerest/everest-ci
-
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.
Signed-off-by: Coury Richards <[email protected]>
- Loading branch information
1 parent
ea4a417
commit c7e081a
Showing
1 changed file
with
70 additions
and
28 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 |
---|---|---|
@@ -1,44 +1,86 @@ | ||
name: build-kit docker image | ||
|
||
on: | ||
workflow_dispatch: | ||
inputs: | ||
base-system: | ||
type: choice | ||
description: Base system type | ||
default: 'alpine' | ||
required: true | ||
options: | ||
- alpine | ||
- debian | ||
tag: | ||
type: string | ||
description: Image tag | ||
default: 'latest' | ||
|
||
push: | ||
branches: | ||
- "**" | ||
tags: | ||
- "v*.*.*" | ||
pull_request: | ||
branches: | ||
- main | ||
jobs: | ||
main: | ||
name: Build and push | ||
build-and-push-alpine: | ||
name: Build and push Alpine | ||
runs-on: ubuntu-latest | ||
permissions: | ||
contents: read | ||
packages: write | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- name: Setup docker buildx | ||
uses: docker/setup-buildx-action@v2 | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
- name: Docker meta | ||
id: meta | ||
uses: docker/metadata-action@v5 | ||
with: | ||
# list of Docker images to use as base name for tags | ||
images: | | ||
ghcr.io/${{github.event.repository.owner.name}}/${{github.event.repository.name}}/build-kit-alpine | ||
# generate Docker tags based on the following events/attributes | ||
tags: | | ||
type=ref,event=branch | ||
type=ref,event=pr | ||
type=semver,pattern={{version}} | ||
type=semver,pattern={{major}}.{{minor}} | ||
type=semver,pattern={{major}} | ||
type=sha | ||
- name: Log in to container registry | ||
uses: docker/login-action@v3 | ||
with: | ||
registry: ghcr.io | ||
username: ${{ github.actor}} | ||
password: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- name: Login to ghcr.io | ||
uses: docker/login-action@v2 | ||
- name: Build and push | ||
uses: docker/build-push-action@v5 | ||
with: | ||
context: docker/images/build-kit | ||
file: docker/images/build-kit/alpine.Dockerfile | ||
tags: ${{ steps.meta.outputs.tags }} | ||
push: true | ||
build-and-push-debian: | ||
name: Build and push Debian | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
- name: Docker meta | ||
id: meta | ||
uses: docker/metadata-action@v5 | ||
with: | ||
# list of Docker images to use as base name for tags | ||
images: | | ||
ghcr.io/${{github.event.repository.owner.name}}/${{github.event.repository.name}}/build-kit-debian | ||
# generate Docker tags based on the following events/attributes | ||
tags: | | ||
type=ref,event=branch | ||
type=ref,event=pr | ||
type=semver,pattern={{version}} | ||
type=semver,pattern={{major}}.{{minor}} | ||
type=semver,pattern={{major}} | ||
type=sha | ||
- name: Log in to container registry | ||
uses: docker/login-action@v3 | ||
with: | ||
registry: ghcr.io | ||
username: ${{ github.actor }} | ||
username: ${{ github.actor}} | ||
password: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- name: Build and push | ||
uses: docker/build-push-action@v4 | ||
uses: docker/build-push-action@v5 | ||
with: | ||
context: docker/images/build-kit | ||
file: docker/images/build-kit/${{ inputs.base-system }}.Dockerfile | ||
tags: ghcr.io/everest/build-kit-${{ inputs.base-system }}:${{ inputs.tag }} | ||
file: docker/images/build-kit/debian.Dockerfile | ||
tags: ${{ steps.meta.outputs.tags }} | ||
push: true | ||
cache-from: type=gha | ||
cache-to: type=gha,mode=max | ||
|