51 lines
1.2 KiB
YAML
51 lines
1.2 KiB
YAML
name: Build and push Docker image
|
|
|
|
"on":
|
|
push:
|
|
branches:
|
|
- main
|
|
- master
|
|
workflow_dispatch:
|
|
|
|
env:
|
|
REGISTRY: git.mpakosrv.ru
|
|
IMAGE: git.mpakosrv.ru/mpakobecex/mpakoimageaibot
|
|
|
|
jobs:
|
|
docker:
|
|
runs-on: ubuntu-latest
|
|
timeout-minutes: 20
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Login to registry
|
|
env:
|
|
REGISTRY_USER: ${{ secrets.REGISTRY_USER }}
|
|
REGISTRY_TOKEN: ${{ secrets.REGISTRY_TOKEN }}
|
|
run: |
|
|
echo "$REGISTRY_TOKEN" | docker login "$REGISTRY" \
|
|
--username "$REGISTRY_USER" \
|
|
--password-stdin
|
|
|
|
- name: Build image
|
|
run: |
|
|
docker build \
|
|
--label org.opencontainers.image.revision=${{ github.sha }} \
|
|
-t mpakoimageaibot:latest \
|
|
-t "$IMAGE:latest" \
|
|
-t "$IMAGE:${GITHUB_SHA}" \
|
|
.
|
|
|
|
- name: Push image
|
|
run: |
|
|
docker push "$IMAGE:latest"
|
|
docker push "$IMAGE:${GITHUB_SHA}"
|
|
|
|
- name: Show image
|
|
run: docker images mpakoimageaibot
|
|
|
|
- name: Logout
|
|
if: always()
|
|
run: docker logout "$REGISTRY" || true
|