TEST: actions
Some checks failed
build / build-and-push (push) Failing after 2m2s
Gitea Actions Demo / Explore-Gitea-Actions (push) Successful in 14s

This commit is contained in:
2025-12-16 21:24:59 +01:00
parent 31152e257a
commit 611d8e0f35
2 changed files with 23 additions and 42 deletions

View File

@@ -6,45 +6,26 @@ on:
- main - main
jobs: jobs:
build: build-and-push:
runs-on: [k8s, kaniko] runs-on: [k8s, kaniko]
steps:
- name: Instalar y ejecutar Kaniko (todo en uno) steps:
env: - name: Checkout repository
NEXUS_USER: ${{ secrets.NEXUS_USER }} uses: actions/checkout@v3
NEXUS_PASSWORD: ${{ secrets.NEXUS_PASSWORD }}
run: | - name: Set up Docker Buildx
# 1. Instalar Kaniko uses: docker/setup-buildx-action@v3
KANIKO_VERSION="v1.19.0"
echo "📦 Instalando Kaniko ${KANIKO_VERSION}..." - name: Login to Docker Registry
apt-get update && apt-get install curl -y uses: docker/login-action@v2
curl -sfL https://github.com/GoogleContainerTools/kaniko/releases/download/${KANIKO_VERSION}/kaniko-executor \ with:
-o /tmp/kaniko-executor username: ${{ secrets.DOCKER_USERNAME }}
chmod +x /tmp/kaniko-executor password: ${{ secrets.DOCKER_PASSWORD }}
registry: docker.io # Cambia si usas otro registro
# 2. Configurar credenciales
echo "🔐 Configurando credenciales..." - name: Build and push Docker image
mkdir -p /kaniko/.docker uses: docker/build-push-action@v5
AUTH_TOKEN=$(echo -n "$NEXUS_USER:$NEXUS_PASSWORD" | base64) with:
cat > /kaniko/.docker/config.json <<EOF context: .
{ push: true
"auths": { tags: docker.io/tu_usuario/tu_imagen:latest
"nexus.server.duckdns.org": {
"auth": "${AUTH_TOKEN}"
}
}
}
EOF
# 3. Construir y subir imagen
echo "🚀 Ejecutando Kaniko..."
/tmp/kaniko-executor \
--context=. \
--dockerfile=./Dockerfile \
--destination=nexus.rancherk3.duckdns.org/tfm/microserviciospytho:latest \
--destination=nexus.rancherk3.duckdns.org/tfm/microserviciospytho:${{ gitea.sha }} \
--cache=true \
--cache-ttl=72h \
--verbosity=info
echo "✅ Imagen construida y subida exitosamente"

View File

@@ -4,7 +4,7 @@ on: [push]
jobs: jobs:
Explore-Gitea-Actions: Explore-Gitea-Actions:
runs-on: ubuntu-latest runs-on: k8s
steps: steps:
- run: echo "🎉 The job was automatically triggered by a ${{ gitea.event_name }} event." - run: echo "🎉 The job was automatically triggered by a ${{ gitea.event_name }} event."
- run: echo "🐧 This job is now running on a ${{ runner.os }} server hosted by Gitea!" - run: echo "🐧 This job is now running on a ${{ runner.os }} server hosted by Gitea!"