From 20ebd472f3a6d03b1af3b2aa323b9e4a3692da68 Mon Sep 17 00:00:00 2001 From: Daniel Date: Mon, 20 Apr 2026 08:18:51 +0200 Subject: [PATCH] Add GitHub Actions workflow for building and pushing Docker images --- .github/workflows/docker.yml | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 .github/workflows/docker.yml 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