diff --git a/.github/workflows/docker-image.yml b/.github/workflows/docker-image.yml new file mode 100644 index 0000000..6cc3b96 --- /dev/null +++ b/.github/workflows/docker-image.yml @@ -0,0 +1,62 @@ +# This is a basic workflow to help you get started with Actions + +name: CI + +# Controls when the workflow will run +on: + push: + branches: + - 'main' + tags: + - 'v*' + pull_request: + branches: + - 'main' + + # Allows you to run this workflow manually from the Actions tab + workflow_dispatch: + +# A workflow run is made up of one or more jobs that can run sequentially or in parallel +jobs: + # This workflow contains a single job called "build" + build: + # The type of runner that the job will run on + runs-on: ubuntu-latest + + # Steps represent a sequence of tasks that will be executed as part of the job + steps: + - + name: Checkout + uses: actions/checkout@v3 + - + name: Set up QEMU + uses: docker/setup-qemu-action@v2 + - + name: Set up Docker Buildx + uses: docker/setup-buildx-action@v2 + - + name: Login to Docker Hub + if: github.event_name != 'pull_request' + uses: docker/login-action@v2 + with: + username: ${{ secrets.DOCKER_HUB_USERNAME }} + password: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }} + - + name: Extract metadata (tags, labels) for Docker + if: github.event_name != 'pull_request' + id: meta + uses: docker/metadata-action@v4 + with: + images: kennyopennix/wazuh-agent + tags: | + type=raw,value=latest,enable={{is_default_branch}} + - + name: Build and push + if: github.event_name != 'pull_request' + uses: docker/build-push-action@v3 + with: + context: . + file: ./Dockerfile + push: true + tags: ${{ steps.meta.outputs.tags }} + labels: ${{ steps.meta.outputs.labels }}