📦 build(ci): add build-and-push workflow for docker images
Some checks failed
build-and-push / docker (push) Failing after 4s

- create a new CI workflow to automate image building and pushing
- trigger workflow on push to main branch
- include steps for checkout, login, build, and push docker images
This commit is contained in:
nocci 2025-12-29 14:31:25 +00:00
parent 76f578e2e6
commit a21dced86e

View file

@ -0,0 +1,26 @@
name: build-and-push
on:
push:
branches:
- main
jobs:
docker:
runs-on: self-hosted
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Login to registry
run: echo "${{ secrets.REG_TOKEN }}" | docker login "${{ secrets.REGISTRY }}" -u "${{ secrets.REG_USER }}" --password-stdin
- name: Build image
run: |
docker build -t "${{ secrets.REGISTRY_IMAGE }}:${{ github.sha }}" \
-t "${{ secrets.REGISTRY_IMAGE }}:latest" .
- name: Push image
run: |
docker push "${{ secrets.REGISTRY_IMAGE }}:${{ github.sha }}"
docker push "${{ secrets.REGISTRY_IMAGE }}:latest"