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
26 lines
697 B
YAML
26 lines
697 B
YAML
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"
|