@@ -111,4 +111,46 @@ jobs:
111111 scan-ref : ' ./'
112112 exit-code : 1
113113 severity : ' CRITICAL,HIGH'
114- trivy-config : ./config/trivy/trivy.yaml
114+ trivy-config : ./config/trivy/trivy.yaml
115+ docker-build-push :
116+ if : github.ref == 'refs/heads/main'
117+ runs-on : ubuntu-latest
118+ needs :
119+ - unit-test
120+ - mutation-test
121+ - dependency-vulnerability-analysis
122+ - sast-code-snyk
123+ - sast-dockerfile-trivy-hadolint
124+ steps :
125+ - name : Login to Docker Hub
126+ uses : docker/login-action@v3
127+ with :
128+ username : ${{ vars.DOCKERHUB_USERNAME }}
129+ password : ${{ secrets.DOCKERHUB_TOKEN }}
130+ - name : Set up Docker Buildx
131+ uses : docker/setup-buildx-action@v3
132+ - name : Docker meta
133+ id : meta
134+ uses : docker/metadata-action@v5
135+ with :
136+ images : |
137+ abhisheksr01/companieshouse
138+ tags : |
139+ type=ref,event=branch
140+ type=ref,event=pr
141+ type=semver,pattern={{version}}
142+ type=semver,pattern={{major}}.{{minor}}
143+ labels : |
144+ "org.opencontainers.image.title": "abhisheksr01/companieshouse",
145+ "org.opencontainers.image.description": "Best practices and integrations available for Spring Boot based Microservice in a single repository with companieshouse API use case.",
146+ "org.opencontainers.image.url": "https://github.com/abhisheksr01/spring-boot-microservice-best-practices",
147+ "org.opencontainers.image.source": "https://github.com/abhisheksr01/spring-boot-microservice-best-practices",
148+ "org.opencontainers.image.version": "0.1.0",
149+ "org.opencontainers.image.created": "2020-01-10T00:30:00.000Z",
150+ "org.opencontainers.image.revision": ${{ github.sha }},
151+ "org.opencontainers.image.licenses": "MIT"
152+ - name : Build and push
153+ uses : docker/build-push-action@v6
154+ with :
155+ push : true
156+ tags : abhisheksr01/companieshouse:latest
0 commit comments