TEST: actions
This commit is contained in:
@@ -8,23 +8,42 @@ on:
|
||||
jobs:
|
||||
build:
|
||||
runs-on: [k8s, kaniko]
|
||||
container:
|
||||
image: catthehacker/ubuntu:act-latest
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: https://gitea.com/actions/checkout@v4
|
||||
|
||||
- name: Login a Nexus
|
||||
- name: Instalar y ejecutar Kaniko (todo en uno)
|
||||
env:
|
||||
NEXUS_USER: ${{ secrets.NEXUS_USER }}
|
||||
NEXUS_PASSWORD: ${{ secrets.NEXUS_PASSWORD }}
|
||||
run: |
|
||||
echo "$NEXUS_PASSWORD" | docker login nexus.rancherk3.duckdns.org -u "$NEXUS_USER" --password-stdin
|
||||
|
||||
- name: Build & Push image with Kaniko
|
||||
uses: docker://gcr.io/kaniko-project/executor:latest
|
||||
with:
|
||||
args: >
|
||||
--context=.
|
||||
--dockerfile=./Dockerfile
|
||||
--destination=nexus.rancherk3.duckdns.org/tfm/microserviciospython:latest
|
||||
# 1. Instalar Kaniko
|
||||
KANIKO_VERSION="v1.19.0"
|
||||
echo "📦 Instalando Kaniko ${KANIKO_VERSION}..."
|
||||
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
|
||||
echo "🔐 Configurando credenciales..."
|
||||
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
|
||||
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"
|
||||
Reference in New Issue
Block a user