Skip to content

Commit

Permalink
ci: add docker workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
paoloyx committed May 24, 2024
1 parent cc78345 commit a0fc7af
Showing 1 changed file with 61 additions and 0 deletions.
61 changes: 61 additions & 0 deletions .github/workflows/docker.yaml
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 }}

0 comments on commit a0fc7af

Please sign in to comment.