Skip to content

Commit

Permalink
Fix docker build with slash in repo name
Browse files Browse the repository at this point in the history
  • Loading branch information
Moulick committed Mar 2, 2024
1 parent 592dcce commit 6dc50d7
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
6 changes: 4 additions & 2 deletions .github/workflows/docker-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,13 +40,15 @@ jobs:
password: ${{ secrets.DOCKERHUB_TOKEN }}

- name: Convert slash in branch name
run: echo ::set-env name=BRANCH_NAME::$(echo ${{ github.head_ref }} | tr / -)
run: |
BRANCH_NAME=$(echo ${{ github.head_ref }} | tr / -)
echo "BRANCH_NAME=$BRANCH_NAME" >> $GITHUB_ENV
- name: Build${{ github.ref_name == 'master' && ' and push' || '' }}
uses: docker/build-push-action@v4
with:
context: .
push: ${{ github.ref_name == 'master'}}
tags: moulick/debug-image:${{ github.ref_name == 'master' && 'latest' || env.BRANCH_NAME }}
tags: docker.io/moulick/debug-image:${{ github.ref_name == 'master' && 'latest' || env.BRANCH_NAME }}
cache-from: type=gha
cache-to: type=gha,mode=max
4 changes: 2 additions & 2 deletions .github/workflows/trivy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -55,12 +55,12 @@ jobs:

- name: Build an image from Dockerfile
run: |
docker build -t docker.io/moulick/ingress-whitelister:${{ github.sha }} .
docker build -t docker.io/moulick/debug-image:${{ github.sha }} .
- name: Run Trivy vulnerability scanner
uses: aquasecurity/trivy-action@master
with:
image-ref: 'docker.io/moulick/ingress-whitelister:${{ github.sha }}'
image-ref: 'docker.io/moulick/debug-image:${{ github.sha }}'
format: 'sarif'
output: 'trivy-oci-image.sarif'
severity: 'CRITICAL,HIGH'
Expand Down

0 comments on commit 6dc50d7

Please sign in to comment.