43 lines
1.0 KiB
YAML
43 lines
1.0 KiB
YAML
name: Docker Build
|
|
|
|
on:
|
|
push:
|
|
branches:
|
|
- main
|
|
pull_request:
|
|
branches:
|
|
- main
|
|
|
|
env:
|
|
REGISTRY_USER: admin
|
|
REGISTRY_PASSWORD: 6nkTT9Th5z6gR?ro
|
|
IMAGE_REGISTRY: hub.docker.xiaohei.one
|
|
IMAGE_TAGS: {{ github.sha }}
|
|
|
|
jobs:
|
|
build:
|
|
name: Build and push docker image
|
|
runs-on: ubuntu-22.04
|
|
|
|
steps:
|
|
- name: Checkout code
|
|
uses: actions/checkout@v4
|
|
|
|
- name: install podman
|
|
run: apt update && apt install podman -y
|
|
|
|
- name: Build Docker Image
|
|
run: podman build -t ${{ steps.build_image.outputs.image }}:${{ steps.build_image.outputs.tags }} .
|
|
|
|
- name: login to registry
|
|
uses: redhat-actions/podman-login@v1
|
|
with:
|
|
username: ${{ env.REGISTRY_USER }}
|
|
password: ${{ env.REGISTRY_PASSWORD }}
|
|
|
|
- name: push to registry
|
|
uses: redhat-actions/push-to-registry@v2
|
|
with:
|
|
image: ${{ steps.build_image.outputs.image }}
|
|
tags: ${{ steps.build_image.outputs.tags }}
|
|
registry: ${{ env.IMAGE_REGISTRY }} |