Updated workflow to use company workflows
All checks were successful
Build & push Docker image / publish (push) Successful in 9m25s
All checks were successful
Build & push Docker image / publish (push) Successful in 9m25s
This commit is contained in:
@@ -3,40 +3,32 @@ name: Build & push Docker image
|
|||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
branches:
|
branches:
|
||||||
- '*' # Trigger on push to all branches
|
- '*'
|
||||||
|
|
||||||
env:
|
env:
|
||||||
IMAGE_NAME: "contact-api" # e.g wavyzz/hello-world
|
REGISTRY_HOST: ${{ secrets.REGISTRY_HOST }}
|
||||||
DOCKERFILE: "./Dockerfile"
|
REGISTRY_USERNAME: ${{ secrets.REGISTRY_USERNAME }}
|
||||||
|
REGISTRY_PASSWORD: ${{ secrets.REGISTRY_PASSWORD }}
|
||||||
|
IMAGE_NAME: "contact-api"
|
||||||
|
CONTEXT_PATH: "."
|
||||||
|
DOCKERFILE_PATH: "./Dockerfile"
|
||||||
|
PLATFORMS: "linux/amd64"
|
||||||
|
CACHE_REF: ${{ env.REGISTRY_HOST }}/${{ env.IMAGE_NAME }}:buildcache
|
||||||
|
GITEA_TOKEN: ${{ secrets.CI_GITEA_TOKEN }}
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
publish:
|
publish:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Build & push Docker image
|
||||||
uses: https://github.com/actions/checkout@v5
|
uses: estebanthi/ci/actions/docker-build-push@master
|
||||||
|
|
||||||
- name: Extract branch name
|
|
||||||
shell: bash
|
|
||||||
run: echo "branch=${GITHUB_HEAD_REF:-${GITHUB_REF#refs/heads/}}" >> $GITHUB_OUTPUT
|
|
||||||
id: extract_branch
|
|
||||||
|
|
||||||
- name: Set up Docker Buildx
|
|
||||||
uses: https://github.com/docker/setup-buildx-action@v3
|
|
||||||
|
|
||||||
- name: Login to private registry
|
|
||||||
uses: docker/login-action@v3
|
|
||||||
with:
|
with:
|
||||||
registry: https://${{ secrets.DOCKER_REGISTRY_HOST }}
|
registry: ${{ env.REGISTRY_HOST }}
|
||||||
username: ${{ secrets.DOCKER_REGISTRY_USER }}
|
username: ${{ env.REGISTRY_USERNAME }}
|
||||||
password: ${{ secrets.DOCKER_REGISTRY_PASSWORD }}
|
password: ${{ env.REGISTRY_PASSWORD }}
|
||||||
|
image_name: ${{ env.IMAGE_NAME }}
|
||||||
- name: Build and push Docker image
|
context_path: ${{ env.CONTEXT_PATH }}
|
||||||
uses: https://github.com/docker/build-push-action@v5
|
dockerfile_path: ${{ env.DOCKERFILE_PATH }}
|
||||||
with:
|
platforms: ${{ env.PLATFORMS }}
|
||||||
context: .
|
cache_ref: ${{ env.CACHE_REF }}
|
||||||
file: "${{ env.DOCKERFILE }}"
|
github_token: ${{ secrets.GITEA_TOKEN }}
|
||||||
push: true
|
|
||||||
tags: |
|
|
||||||
${{ secrets.DOCKER_REGISTRY_HOST }}/${{ env.IMAGE_NAME }}:${{ steps.extract_branch.outputs.branch }}
|
|
||||||
${{ secrets.DOCKER_REGISTRY_HOST }}/${{ env.IMAGE_NAME }}:latest
|
|
||||||
|
|||||||
Reference in New Issue
Block a user