Merge pull request #20 from CirclesUBI/feature/build-docker-image-on-dev
build docker image on dev
This commit is contained in:
commit
fe2d0c1776
1 changed files with 10 additions and 98 deletions
108
.github/workflows/build-and-push.yml
vendored
108
.github/workflows/build-and-push.yml
vendored
|
@ -1,102 +1,14 @@
|
||||||
name: Build and push image
|
name: Images
|
||||||
|
|
||||||
on:
|
on:
|
||||||
workflow_call:
|
push:
|
||||||
inputs:
|
branches:
|
||||||
image:
|
- dev
|
||||||
description: "The desired name of the image to build"
|
|
||||||
default: 'pathfinder2'
|
|
||||||
required: false
|
|
||||||
type: string
|
|
||||||
workflow_dispatch:
|
|
||||||
inputs:
|
|
||||||
image:
|
|
||||||
description: "The desired name of the image to build"
|
|
||||||
default: 'pathfinder2'
|
|
||||||
required: false
|
|
||||||
type: string
|
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
|
call-build-and-push:
|
||||||
build-and-push-image:
|
name: Call
|
||||||
|
uses: CirclesUBI/.github/.github/workflows/build-and-push.yml@main
|
||||||
runs-on: ubuntu-latest
|
with:
|
||||||
permissions:
|
image-name: "pathfinder2
|
||||||
contents: read
|
secrets: inherit
|
||||||
id-token: write
|
|
||||||
packages: write
|
|
||||||
|
|
||||||
steps:
|
|
||||||
|
|
||||||
-
|
|
||||||
name: Checkout repository
|
|
||||||
uses: actions/checkout@v3
|
|
||||||
|
|
||||||
-
|
|
||||||
name: Set up Docker Buildx
|
|
||||||
uses: docker/setup-buildx-action@v2
|
|
||||||
with:
|
|
||||||
driver-opts: |
|
|
||||||
image=moby/buildkit:v0.10.6
|
|
||||||
|
|
||||||
-
|
|
||||||
name: Docker meta
|
|
||||||
id: meta
|
|
||||||
uses: docker/metadata-action@v4
|
|
||||||
with:
|
|
||||||
images: |
|
|
||||||
${{ vars.GC_REGISTRY }}/${{ vars.GC_PROJECT_ID }}/${{ inputs.image }}
|
|
||||||
docker.io/${{ vars.DH_ORGANIZATION }}/${{ inputs.image }}
|
|
||||||
ghcr.io/${{ github.repository_owner }}/${{ inputs.image }}
|
|
||||||
labels: |
|
|
||||||
org.opencontainers.image.title=${{ inputs.image }}
|
|
||||||
org.opencontainers.image.vendor=CirclesUBI
|
|
||||||
tags: |
|
|
||||||
type=raw,value=latest,enable={{is_default_branch}}
|
|
||||||
type=semver,pattern={{version}}
|
|
||||||
{{ tag }}
|
|
||||||
{{ base_ref }}
|
|
||||||
{{ branch }}
|
|
||||||
type=sha,prefix={{branch}}-
|
|
||||||
{{ sha }}
|
|
||||||
|
|
||||||
-
|
|
||||||
name: Authenticate to Google Cloud
|
|
||||||
id: auth
|
|
||||||
uses: google-github-actions/auth@v1
|
|
||||||
with:
|
|
||||||
workload_identity_provider: "${{ vars.GC_WLI_PROVIDER }}"
|
|
||||||
service_account: "${{ vars.GC_WLI_SA }}"
|
|
||||||
token_format: 'access_token'
|
|
||||||
|
|
||||||
-
|
|
||||||
name: Login to Google Cloud Container Registry
|
|
||||||
uses: docker/login-action@v2
|
|
||||||
with:
|
|
||||||
registry: ${{ vars.GC_REGISTRY }}
|
|
||||||
username: 'oauth2accesstoken'
|
|
||||||
password: '${{ steps.auth.outputs.access_token }}'
|
|
||||||
|
|
||||||
-
|
|
||||||
name: Login to Docker Hub Registry
|
|
||||||
uses: docker/login-action@v2
|
|
||||||
with:
|
|
||||||
registry: docker.io
|
|
||||||
username: ${{ vars.DH_USERNAME }}
|
|
||||||
password: ${{ secrets.DH_TOKEN }}
|
|
||||||
|
|
||||||
-
|
|
||||||
name: Login to GitHub Packages Registry
|
|
||||||
uses: docker/login-action@v2
|
|
||||||
with:
|
|
||||||
registry: ghcr.io
|
|
||||||
username: ${{ github.actor }}
|
|
||||||
password: ${{ secrets.GITHUB_TOKEN }}
|
|
||||||
|
|
||||||
-
|
|
||||||
name: Build and push Container image
|
|
||||||
uses: docker/build-push-action@v3
|
|
||||||
with:
|
|
||||||
push: true
|
|
||||||
tags: ${{ steps.meta.outputs.tags }}
|
|
||||||
labels: ${{ steps.meta.outputs.labels }}
|
|
||||||
|
|
Loading…
Reference in a new issue