ci: switch to dind runner for Docker build and push
Some checks failed
Build and Push Docker Image / build-and-push (push) Failing after 27s

This commit is contained in:
2026-02-23 19:08:07 +01:00
parent 31567e0c56
commit fba99f5d16

View File

@@ -7,45 +7,37 @@ on:
tags:
- "v*"
env:
REGISTRY: gitea.jeanlucmakiola.de
IMAGE_NAME: ${{ gitea.repository }}
jobs:
build-and-push:
runs-on: ubuntu-latest
runs-on: dind
container:
image: docker:cli
services:
dind:
image: docker:dind
options: --privileged
env:
DOCKER_TLS_CERTDIR: ""
env:
DOCKER_HOST: tcp://dind:2375
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to Gitea Container Registry
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ gitea.actor }}
password: ${{ secrets.GITEA_TOKEN }}
- name: Extract metadata
id: meta
uses: docker/metadata-action@v5
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
tags: |
type=ref,event=branch
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
type=raw,value=latest,enable=${{ gitea.ref == 'refs/heads/main' }}
- name: Log in to Gitea registry
run: |
REGISTRY="${{ gitea.server_url }}"
REGISTRY="${REGISTRY#https://}"
REGISTRY="${REGISTRY#http://}"
echo "${{ secrets.GITEA_TOKEN }}" | docker login "$REGISTRY" -u "${{ gitea.actor }}" --password-stdin
- name: Build and push
uses: docker/build-push-action@v6
with:
context: .
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=gha
cache-to: type=gha,mode=max
run: |
REGISTRY="${{ gitea.server_url }}"
REGISTRY="${REGISTRY#https://}"
REGISTRY="${REGISTRY#http://}"
IMAGE="$REGISTRY/${{ gitea.repository }}"
docker build -t "$IMAGE:${{ gitea.sha }}" -t "$IMAGE:latest" .
docker push "$IMAGE:${{ gitea.sha }}"
docker push "$IMAGE:latest"