Fix Kaniko (+1 squashed commits)
Squashed commits:
[98c2593] Retry Kaniko
			
			
This commit is contained in:
		| @@ -6,55 +6,54 @@ on: | |||||||
|       - main |       - main | ||||||
|  |  | ||||||
| jobs: | jobs: | ||||||
|   build-and-deploy: |   build-and-push: | ||||||
|     runs-on: ubuntu-latest |     runs-on: ubuntu-latest | ||||||
|  |  | ||||||
|     steps: |     steps: | ||||||
|       - name: Checkout code |       - name: Checkout code | ||||||
|         uses: actions/checkout@v3 |         uses: actions/checkout@v3 | ||||||
|  |  | ||||||
|       # --- Instalar Docker en el Entorno del Job --- |       - name: Create Kaniko config file | ||||||
|       - name: Install Docker CLI |  | ||||||
|         run: | |         run: | | ||||||
|           apt-get update |           echo '{"auths":{"${{ secrets.REGISTRY_URL }}":{"username":"${{ secrets.REGISTRY_USER }}","password":"${{ secrets.ACTIONS_PAT }}"}}}' > /kaniko/config.json | ||||||
|           apt-get install -y --no-install-recommends ca-certificates curl |         # Este comando crea el fichero de credenciales que Kaniko necesita. | ||||||
|           install -m 0755 -d /etc/apt/keyrings |         # Lo creamos en un directorio que montaremos en el siguiente paso. | ||||||
|           curl -fsSL https://download.docker.com/linux/debian/gpg -o /etc/apt/keyrings/docker.asc |  | ||||||
|           chmod a+r /etc/apt/keyrings/docker.asc |  | ||||||
|           echo \ |  | ||||||
|             "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.asc] https://download.docker.com/linux/debian \ |  | ||||||
|             $(. /etc/os-release && echo "$VERSION_CODENAME") stable" | \ |  | ||||||
|             tee /etc/apt/sources.list.d/docker.list > /dev/null |  | ||||||
|           apt-get update |  | ||||||
|           apt-get install -y docker-ce-cli |  | ||||||
|  |  | ||||||
|       - name: Login to Gitea Container Registry |       - name: Build and Push Backend | ||||||
|         uses: docker/login-action@v2 |         run: | | ||||||
|         with: |           docker run --rm \ | ||||||
|           registry: ${{ secrets.REGISTRY_URL }} |             -v ${{ gitea.workspace }}:/workspace \ | ||||||
|           username: ${{ secrets.REGISTRY_USER }} |             -v /kaniko/config.json:/kaniko/.docker/config.json \ | ||||||
|           password: ${{ secrets.ACTIONS_PAT }} |             gcr.io/kaniko-project/executor:v1.9.0 \ | ||||||
|  |             --context=/workspace \ | ||||||
|  |             --dockerfile=/workspace/Backend/GestionIntegral.Api/Dockerfile \ | ||||||
|  |             --destination=${{ secrets.REGISTRY_URL }}/${{ gitea.actor }}/${{ toLower(gitea.repository_name) }}-backend:latest \ | ||||||
|  |             --destination=${{ secrets.REGISTRY_URL }}/${{ gitea.actor }}/${{ toLower(gitea.repository_name) }}-backend:${{ gitea.sha_short }} \ | ||||||
|  |             --insecure | ||||||
|  |  | ||||||
|       - name: Build and Push Backend Image |       - name: Build and Push Frontend | ||||||
|         uses: docker/build-push-action@v4 |         run: | | ||||||
|         with: |           docker run --rm \ | ||||||
|           context: . |             -v ${{ gitea.workspace }}:/workspace \ | ||||||
|           file: Backend/GestionIntegral.Api/Dockerfile |             -v /kaniko/config.json:/kaniko/.docker/config.json \ | ||||||
|           push: true |             gcr.io/kaniko-project/executor:v1.9.0 \ | ||||||
|           tags: ${{ secrets.REGISTRY_URL }}/${{ gitea.actor }}/${{ toLower(gitea.repository_name) }}-backend:latest,${{ secrets.REGISTRY_URL }}/${{ gitea.actor }}/${{ toLower(gitea.repository_name) }}-backend:${{ gitea.sha_short }} |             --context=/workspace \ | ||||||
|  |             --dockerfile=/workspace/Frontend/Dockerfile \ | ||||||
|  |             --destination=${{ secrets.REGISTRY_URL }}/${{ gitea.actor }}/${{ toLower(gitea.repository_name) }}-frontend:latest \ | ||||||
|  |             --destination=${{ secrets.REGISTRY_URL }}/${{ gitea.actor }}/${{ toLower(gitea.repository_name) }}-frontend:${{ gitea.sha_short }} \ | ||||||
|  |             --insecure | ||||||
|  |  | ||||||
|       - name: Build and Push Frontend Image |   deploy: | ||||||
|         uses: docker/build-push-action@v4 |     runs-on: ubuntu-latest | ||||||
|         with: |     needs: build-and-push | ||||||
|           context: . |  | ||||||
|           file: Frontend/Dockerfile |  | ||||||
|           push: true |  | ||||||
|           tags: ${{ secrets.REGISTRY_URL }}/${{ gitea.actor }}/${{ toLower(gitea.repository_name) }}-frontend:latest,${{ secrets.REGISTRY_URL }}/${{ gitea.actor }}/${{ toLower(gitea.repository_name) }}-frontend:${{ gitea.sha_short }} |  | ||||||
|      |      | ||||||
|  |     steps: | ||||||
|       - name: Deploy to Production |       - name: Deploy to Production | ||||||
|         run: | |         run: | | ||||||
|           echo "Deploying to production server..." |           # Este paso no necesita cambios, pero para mantenerlo simple, | ||||||
|           # Ya no necesitamos instalar openssh-client, porque la imagen base ya lo tiene. |           # lo ejecutaremos directamente sin la acción de checkout, | ||||||
|  |           # ya que no necesita los ficheros del repositorio. | ||||||
|  |           apk add --no-cache openssh-client | ||||||
|           mkdir -p ~/.ssh |           mkdir -p ~/.ssh | ||||||
|           echo "${{ secrets.PROD_SERVER_SSH_KEY }}" > ~/.ssh/id_rsa |           echo "${{ secrets.PROD_SERVER_SSH_KEY }}" > ~/.ssh/id_rsa | ||||||
|           chmod 600 ~/.ssh/id_rsa |           chmod 600 ~/.ssh/id_rsa | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user