Update main.yml #70
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Build and Publish | |
on: [push] | |
jobs: | |
build_and_publish: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v2 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v1 | |
- name: Build Docker image | |
run: docker build . -t goglang:1.10.0 -f ./guestbook-go/Dockerfile | |
- name: Tag Docker image | |
run: docker tag goglang:1.10.0 dikshasahu/golang-image-new:latest1 | |
- name: Scan Docker image with Dockle | |
run: docker run --rm -i hadolint/hadolint < ./guestbook-go/Dockerfile | |
- name: Scan Docker image with Trivy | |
run: trivy image dikshasahu/golang-image-new:latest1 | |
- name: Login to DockerHub | |
uses: docker/login-action@v1 | |
with: | |
username: ${{ secrets.DOCKERHUB_USERNAME }} | |
password: ${{ secrets.DOCKERHUB_TOKEN }} | |
- name: Push Docker image | |
run: docker push dikshasahu/golang-image-new:latest1 | |