diff --git a/.github/workflows/pipeline.yml b/.github/workflows/pipeline.yml new file mode 100644 index 0000000000..708bbf4626 --- /dev/null +++ b/.github/workflows/pipeline.yml @@ -0,0 +1,38 @@ +name:CI-Build +on: + pull_request: + types: [closed] + branches: ["master"] + +jobs: + build-docker-image: + if: github.event.pull_request.merged == true && contains(github.event.pull_request.labels.*.name, 'CI:Build') + runs-on: ubuntu-latest + + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + + - name: Cache Docker layers + uses: actions/cache@v3 + with: + path: /tmp/.buildx-cache + key: ${{ runner.os }}-buildx-${{ github.sha }} + restore-keys: | + ${{ runner.os }}-buildx- + + - name: Log in Docker Hub Container Registry + uses: docker/login-action@v3 + with: + username: ${{ vars.DOCKERHUB_USERNAME }} + password: ${{ secrets.DOCKERHUB_TOKEN }} + + - name: Build and push in Docker Hub Registry + uses: docker/build-push-action@v6 + with: + context: . + push: true + tags: user/app:latest