-
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.
- Loading branch information
Showing
1 changed file
with
61 additions
and
0 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 |
---|---|---|
@@ -0,0 +1,61 @@ | ||
name: build-push | ||
on: | ||
workflow_call: | ||
inputs: | ||
image: | ||
description: 'Image name' | ||
required: true | ||
type: 'string' | ||
tag: | ||
description: 'Name for docker tag' | ||
required: false | ||
type: 'string' | ||
default: 'latest' | ||
push: | ||
description: 'Push image' | ||
required: false | ||
type: 'boolean' | ||
default: false | ||
context: | ||
description: 'Docker build context path' | ||
required: false | ||
type: 'string' | ||
default: '.' | ||
secrets: | ||
USERNAME: | ||
description: 'Registry username' | ||
required: true | ||
PASSWORD: | ||
description: 'Registry password' | ||
required: true | ||
ORGANIZATION: | ||
description: 'Registry organization' | ||
required: true | ||
|
||
jobs: | ||
build-push: | ||
runs-on: ubuntu-22.04 | ||
|
||
steps: | ||
- name: Clone repository | ||
uses: actions/checkout@v3 | ||
|
||
- name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v3 | ||
|
||
- name: Login to Docker Registry | ||
uses: docker/login-action@v3 | ||
with: | ||
username: ${{ secrets.USERNAME }} | ||
password: ${{ secrets.PASSWORD }} | ||
|
||
- name: Log | ||
run: | | ||
echo Building: ${{ inputs.image }}:${{ inputs.tag }} image | ||
- name: Build and push image | ||
uses: docker/build-push-action@v5 | ||
with: | ||
context: ${{ inputs.context }} | ||
push: ${{ inputs.push }} | ||
tags: ${{ secrets.ORGANIZATION }}/${{ inputs.image }}:${{ inputs.tag }} |