diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml new file mode 100644 index 0000000..8298f81 --- /dev/null +++ b/.github/workflows/docker.yml @@ -0,0 +1,35 @@ +name: Build and Push Docker Image + +on: + push: + branches: + - '**' # Esto aplica para cualquier rama + +jobs: + docker: + runs-on: ubuntu-latest + permissions: + contents: read + packages: write # Necesario para subir a GHCR + + steps: + - name: Checkout del código + uses: actions/checkout@v4 + + - name: Configurar Docker Buildx + uses: docker/setup-buildx-action@v3 + + - name: Login en GHCR + uses: docker/login-action@v3 + with: + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + + - name: Build y Push + uses: docker/build-push-action@v6 + with: + context: . + push: true + # Aquí usamos el nombre de la rama dinámicamente + tags: ghcr.io/dsaub/proyecto-mvc:${{ github.ref_name }} \ No newline at end of file