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