Update Dockerfile #20
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Build and Push Multi-Arch Docker Image | |
| on: | |
| push: | |
| branches: [ "master", "main" ] | |
| jobs: | |
| build: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v3 | |
| # 1. Configurar QEMU (necesario para emular ARM durante la compilación) | |
| - name: Set up QEMU | |
| uses: docker/setup-qemu-action@v2 | |
| # 2. Configurar Docker Buildx | |
| - name: Set up Docker Buildx | |
| uses: docker/setup-buildx-action@v2 | |
| # 3. Login en Docker Hub | |
| - name: Login to Docker Hub | |
| uses: docker/login-action@v2 | |
| with: | |
| username: ${{ secrets.DOCKERHUB_USERNAME }} | |
| password: ${{ secrets.DOCKERHUB_TOKEN }} | |
| # 4. Construir y subir para múltiples arquitecturas | |
| - name: Build and push | |
| uses: docker/build-push-action@v4 | |
| with: | |
| context: . | |
| push: true | |
| # Aquí definimos las arquitecturas compatibles | |
| platforms: linux/amd64,linux/arm64 | |
| tags: ${{ secrets.DOCKERHUB_USERNAME }}/wallamonitor:latest | |
| # Usamos caché para que las siguientes compilaciones sean rápidas | |
| cache-from: type=gha | |
| cache-to: type=gha,mode=max |