Merge pull request #49 from testwill/ioutil #67
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: build | |
on: | |
push: | |
branches: [ master ] | |
paths-ignore: | |
# Do not run the pipeline if only Markdown files changed | |
- '**.md' | |
jobs: | |
build-docker: | |
name: Build docker container, tag and upload to registry | |
if: ${{ github.repository == 'kubescape/host-scanner' }} | |
runs-on: ubuntu-latest | |
steps: | |
- 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: Set image version | |
id: image-version | |
run: echo '::set-output name=IMAGE_VERSION::v1.0.${{ github.run_number }}' | |
- name: Set image name | |
id: image-name | |
run: echo '::set-output name=IMAGE_NAME::quay.io/${{ github.repository_owner }}/host-scanner' | |
- name: Login to Quay.io | |
env: | |
QUAY_PASSWORD: ${{ secrets.QUAYIO_REGISTRY_PASSWORD }} | |
QUAY_USERNAME: ${{ secrets.QUAYIO_REGISTRY_USERNAME }} | |
run: docker login -u="${QUAY_USERNAME}" -p="${QUAY_PASSWORD}" quay.io | |
- name: Build the Docker image | |
run: docker buildx build . --file build/Dockerfile --tag ${{ steps.image-name.outputs.IMAGE_NAME }}:${{ steps.image-version.outputs.IMAGE_VERSION }} --tag ${{ steps.image-name.outputs.IMAGE_NAME }}:latest --build-arg BUILD_VERSION=${{ steps.image-version.outputs.IMAGE_VERSION }} --push --platform linux/amd64,linux/arm64 | |
env: | |
CGO_ENABLED: 0 |