diff --git a/.dockerignore b/.dockerignore index c6e6657..1801640 100644 --- a/.dockerignore +++ b/.dockerignore @@ -10,6 +10,7 @@ *swo *swp docker-compose.yaml +docker-compose.yml Dockerfile example/ extra/ diff --git a/.github/workflows/docker-image.yml b/.github/workflows/docker-image.yml index 829f6cb..0b827cf 100644 --- a/.github/workflows/docker-image.yml +++ b/.github/workflows/docker-image.yml @@ -45,30 +45,27 @@ jobs: - uses: rlespinasse/github-slug-action@v4.4.1 - - name: Calculate tag - id: tag - run: | - if [ "$GITHUB_EVENT_NAME" == "pull_request" ]; then - TAG="pr-${{ github.event.number }}" - else - TAG=${{ github.ref_name }} - fi - echo "IMAGE=${{ vars.REGISTRY_URI }}/${{ vars.REGISTRY_ORGANIZATION }}/bbb-webhooks:$TAG" >> $GITHUB_OUTPUT - - name: Docker meta id: meta - uses: docker/metadata-action@v4 + uses: docker/metadata-action@v5 with: - images: ${{ steps.tag.outputs.IMAGE }} + images: ${{ vars.REGISTRY_URI }}/${{ vars.REGISTRY_ORGANIZATION }}/bbb-webhooks + tags: | + type=ref,event=pr + type=ref,event=tag + type=semver,pattern={{major}}.{{minor}}.{{patch}} + type=semver,pattern={{major}}.{{minor}} + type=semver,pattern={{major}} + type=semver,pattern=latest - name: Build and push image - uses: docker/build-push-action@v5 + uses: docker/build-push-action@v6 with: push: true - tags: ${{ steps.tag.outputs.IMAGE }} + tags: ${{ steps.meta.outputs.tags }} context: . platforms: linux/amd64 - cache-from: type=registry,ref=${{ steps.tag.outputs.IMAGE }} + cache-from: type=registry,ref=${{ steps.meta.outputs.tags }} labels: | ${{ steps.meta.outputs.labels }} @@ -81,13 +78,13 @@ jobs: issue_number: context.issue.number, owner: context.repo.owner, repo: context.repo.repo, - body: "Updated Docker image pushed to `${{ steps.tag.outputs.IMAGE }}`" + body: "Updated Docker image pushed to `${{ vars.REGISTRY_URI }}/${{ vars.REGISTRY_ORGANIZATION }}/bbb-webhooks/pr-${{ github.event.number }}`" }) - name: Run Trivy vulnerability scanner uses: aquasecurity/trivy-action@master with: - image-ref: ${{ steps.tag.outputs.IMAGE }} + image-ref: ${{ vars.REGISTRY_URI }}/${{ vars.REGISTRY_ORGANIZATION }}/bbb-webhooks/pr-${{ github.event.number }} format: 'sarif' output: 'trivy-results.sarif' severity: 'CRITICAL,HIGH' diff --git a/Dockerfile b/Dockerfile index c9d88b0..a457cee 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,4 @@ -FROM node:20-alpine +FROM node:22-alpine WORKDIR /app