📦 build(ci): add build-and-push workflow for docker images
Some checks failed
build-and-push / docker (push) Failing after 4s
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:
parent
76f578e2e6
commit
a21dced86e
1 changed files with 26 additions and 0 deletions
26
.forgejo/workflows/build.yml
Normal file
26
.forgejo/workflows/build.yml
Normal 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"
|
||||
Loading…
Add table
Add a link
Reference in a new issue