diff --git a/.github/workflows/docker-image.yml b/.github/workflows/docker-image.yml new file mode 100644 index 0000000..cc6c8fb --- /dev/null +++ b/.github/workflows/docker-image.yml @@ -0,0 +1,45 @@ +name: Docker Image CI + +on: + push: + branches: [ "main" ] + pull_request: + branches: [ "main" ] + +jobs: + build: + runs-on: ubuntu-latest + steps: + - + name: Checkout + uses: actions/checkout@v4 + - + name: Run Hadolint + uses: hadolint/hadolint-action@v3.1.0 + with: + dockerfile: Dockerfile + - + name: Scan Docker image with Trivy + uses: aquasecurity/trivy-action@master + with: + image-ref: ${{ secrets.DOCKERUSER }}/react-todo-list:${{ github.run_number }} + #exit-code-on-severity: "HIGH" + - + name: Login to Docker Hub edgar4all + uses: docker/login-action@v3 + with: + username: ${{ secrets.DOCKERUSER }} + password: ${{ secrets.DOCKERTOKEN }} + + - + name: Build and push + uses: docker/build-push-action@v5 + with: + context: "{{defaultContext}}" + push: true + tags: ${{ secrets.DOCKERUSER }}/react-todo-list:${{ github.run_number }} + + + + +