Skip to content

Commit

Permalink
change yml
Browse files Browse the repository at this point in the history
  • Loading branch information
argotri authored Dec 8, 2023
1 parent d28c787 commit da8592d
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions .github/workflows/docker-image.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,13 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3

- name: Set Docker image reference
id: set-image-ref
run: echo "::set-output name=image-ref::docker.io/${{ secrets.DOCKER_HUB_REPOSITORY }}:${GITHUB_REF#refs/tags/}"
- name: Build image from dockerfile
run: |
echo "${{ secrets.DOCKER_KEY }}" | docker login -u "${{ secrets.DOCKER_HUB_USERNAME }}" --password-stdin docker.io
docker build . --file Dockerfile --tag "${{ steps.set-image-ref.outputs.image-ref }}"
- name: Run Trivy vulnerability scanner
uses: aquasecurity/trivy-action@master
Expand All @@ -25,9 +28,7 @@ jobs:
vuln-type: 'os,library'
severity: 'MEDIUM,CRITICAL,HIGH'

- name: Build and push Docker image
- name: Push Docker image
if: success()
run: |
echo "${{ secrets.DOCKER_KEY }}" | docker login -u "${{ secrets.DOCKER_HUB_USERNAME }}" --password-stdin docker.io
docker build . --file Dockerfile --tag "${{ steps.set-image-ref.outputs.image-ref }}"
docker push "${{ steps.set-image-ref.outputs.image-ref }}"

0 comments on commit da8592d

Please sign in to comment.