45 lines
1.1 KiB
YAML
45 lines
1.1 KiB
YAML
name: Build and Push Docker Image
|
|
|
|
on:
|
|
push:
|
|
branches: [main]
|
|
|
|
jobs:
|
|
build:
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
|
|
- name: Login to Registry
|
|
uses: docker/login-action@v2
|
|
with:
|
|
registry: git.kocoder.xyz
|
|
username: ${{ secrets.REGISTRY_USER }}
|
|
password: ${{ secrets.REGISTRY_PASSWORD }}
|
|
|
|
- name: Install buildah
|
|
run: sudo apt-get -y update && sudo apt-get -y install buildah
|
|
|
|
- name: Buildah Build
|
|
env:
|
|
BRANCH_NAME: ${{ github.ref_name }}
|
|
SHORT_HASH: ${{ github.sha }}
|
|
uses: redhat-actions/buildah-build@v2
|
|
with:
|
|
containerfiles: "Dockerfile"
|
|
iamge: git.kocoder.xyz/kocoded/vt-be
|
|
tags: "v0 latest"
|
|
|
|
- name: Push Docker Images
|
|
env:
|
|
BRANCH_NAME: ${{ github.ref_name }}
|
|
SHORT_HASH: ${{ github.sha }}
|
|
run: |
|
|
docker push git.kocoder.xyz/kocoded/vt-be:${BRANCH_NAME}
|
|
docker push git.kocoder.xyz/kocoded/vt-be:latest
|
|
|
|
- name: Log out from registry
|
|
if: always()
|
|
run: docker logout git.kocoder.xyz
|