|
| 1 | +name: docker |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: |
| 6 | + - master |
| 7 | + pull_request: |
| 8 | + branches: |
| 9 | + - master |
| 10 | + |
| 11 | +concurrency: |
| 12 | + group: ${{ github.workflow }}-${{ github.event_name == 'push' && github.run_number || github.event.pull_request.number }} |
| 13 | + cancel-in-progress: true |
| 14 | + |
| 15 | +jobs: |
| 16 | + docker: |
| 17 | + name: Build Docker image |
| 18 | + runs-on: ubuntu-latest |
| 19 | + steps: |
| 20 | + - name: Checkout code |
| 21 | + uses: actions/checkout@v4 |
| 22 | + |
| 23 | + - name: Setup QEMU |
| 24 | + uses: docker/setup-qemu-action@v3 |
| 25 | + with: |
| 26 | + platforms: amd64,arm64 |
| 27 | + |
| 28 | + - name: Set up Docker Buildx |
| 29 | + uses: docker/setup-buildx-action@v3 |
| 30 | + |
| 31 | + - name: Login to Artifactory |
| 32 | + if: ${{ github.event_name == 'push' }} |
| 33 | + uses: docker/login-action@v3 |
| 34 | + with: |
| 35 | + registry: splitio-docker-dev.jfrog.io |
| 36 | + username: ${{ secrets.ARTIFACTORY_DOCKER_USER }} |
| 37 | + password: ${{ secrets.ARTIFACTORY_DOCKER_PASS }} |
| 38 | + |
| 39 | + - name: Create build version |
| 40 | + run: echo "BUILD_VERSION=$(cat package.json | grep version | head -1 | awk '{ print $2 }' | sed 's/[\",]//g' | tr -d '[[:space:]]')" >> $GITHUB_ENV |
| 41 | + |
| 42 | + - name: Docker build |
| 43 | + uses: docker/build-push-action@v5 |
| 44 | + with: |
| 45 | + context: . |
| 46 | + push: ${{ github.event_name == 'push' }} |
| 47 | + platforms: linux/amd64,linux/arm64 |
| 48 | + tags: splitio-docker-dev.jfrog.io/${{ github.event.repository.name }}:${{ env.BUILD_VERSION}},splitio-docker-dev.jfrog.io/${{ github.event.repository.name }}:latest |
| 49 | + |
| 50 | + lacework: |
| 51 | + name: Scan Docker image |
| 52 | + if: ${{ github.event_name == 'pull_request' }} |
| 53 | + runs-on: ubuntu-latest |
| 54 | + steps: |
| 55 | + - name: Checkout code |
| 56 | + uses: actions/checkout@v4 |
| 57 | + |
| 58 | + - name: Create build version |
| 59 | + run: echo "BUILD_VERSION=$(cat package.json | grep version | head -1 | awk '{ print $2 }' | sed 's/[\",]//g' | tr -d '[[:space:]]')" >> $GITHUB_ENV |
| 60 | + |
| 61 | + - name: Docker build |
| 62 | + uses: docker/build-push-action@v5 |
| 63 | + with: |
| 64 | + context: . |
| 65 | + push: false |
| 66 | + tags: splitio-docker-dev.jfrog.io/${{ github.event.repository.name }}:${{ env.BUILD_VERSION}} |
| 67 | + build-args: | |
| 68 | + ARTIFACTORY_USER=${{ secrets.ARTIFACTORY_USER }} |
| 69 | + ARTIFACTORY_TOKEN=${{ secrets.ARTIFACTORY_TOKEN }} |
| 70 | +
|
| 71 | + - name: Scan container using Lacework |
| 72 | + uses: lacework/lw-scanner-action@v1.4.1 |
| 73 | + with: |
| 74 | + LW_ACCOUNT_NAME: ${{ secrets.LW_ACCOUNT_NAME }} |
| 75 | + LW_ACCESS_TOKEN: ${{ secrets.LW_ACCESS_TOKEN }} |
| 76 | + IMAGE_NAME: splitio-docker-dev.jfrog.io/${{ github.event.repository.name }} |
| 77 | + IMAGE_TAG: ${{ env.BUILD_VERSION}} |
| 78 | + SAVE_RESULTS_IN_LACEWORK: true |
0 commit comments