From d0db45caa61e6bfceabed6dc2c32850edebbdb93 Mon Sep 17 00:00:00 2001 From: saada Date: Wed, 29 Oct 2025 17:00:52 -0400 Subject: [PATCH] Add GitHub Actions workflow for Docker build and push - Builds and pushes Docker images on main branch and PRs - Main branch pushes :latest tag - PRs push :test tag - Uses DOCKERHUB_USERNAME var and DOCKERHUB_TOKEN secret --- .github/workflows/docker.yml | 38 ++++++++++++++++++++++++++++++++++++ 1 file changed, 38 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..3e9beea --- /dev/null +++ b/.github/workflows/docker.yml @@ -0,0 +1,38 @@ +name: docker + +on: + push: + branches: + - main + pull_request: + +jobs: + docker: + runs-on: ubuntu-latest + steps: + - name: Login to Docker Hub + uses: docker/login-action@v3 + with: + username: ${{ vars.DOCKERHUB_USERNAME }} + password: ${{ secrets.DOCKERHUB_TOKEN }} + + - name: Set up QEMU + uses: docker/setup-qemu-action@v3 + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + + - name: Determine Docker tags + id: tags + run: | + if [ "${{ github.ref }}" = "refs/heads/main" ]; then + echo "tags=${{ vars.DOCKERHUB_USERNAME }}/mdx2:latest" >> $GITHUB_OUTPUT + else + echo "tags=${{ vars.DOCKERHUB_USERNAME }}/mdx2:test" >> $GITHUB_OUTPUT + fi + + - name: Build and push + uses: docker/build-push-action@v6 + with: + push: true + tags: ${{ steps.tags.outputs.tags }}