From da8592dfe6d597ef7b57a72783cc618613727740 Mon Sep 17 00:00:00 2001 From: Argo Triwidodo Date: Fri, 8 Dec 2023 16:17:26 +0700 Subject: [PATCH] change yml --- .github/workflows/docker-image.yml | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/.github/workflows/docker-image.yml b/.github/workflows/docker-image.yml index 4e21d58..768a2a5 100644 --- a/.github/workflows/docker-image.yml +++ b/.github/workflows/docker-image.yml @@ -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 @@ -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 }}"