|
| 1 | +name: build-publish-jdk17-tf-deploy-image |
| 2 | +on: |
| 3 | + workflow_dispatch: |
| 4 | + schedule: |
| 5 | + - cron: '0 12 17 * *' # morning 12:00 pm on 17th of every month |
| 6 | + |
| 7 | +run-name: build-publish-jdk17-tf-deploy-image |
| 8 | +jobs: |
| 9 | + build-publish-jdk17-tf-deploy-image: |
| 10 | + runs-on: ubuntu-latest |
| 11 | + |
| 12 | + steps: |
| 13 | + - name: Checkout code |
| 14 | + uses: actions/checkout@v4 |
| 15 | + |
| 16 | + - name: Log in to Docker Hub |
| 17 | + uses: docker/login-action@v3 |
| 18 | + with: |
| 19 | + username: ${{ secrets.DOCKERHUB_USERNAME }} |
| 20 | + password: ${{ secrets.DOCKERHUB_ACCESS_TOKEN }} |
| 21 | + |
| 22 | + - name: Set up QEMU |
| 23 | + uses: docker/setup-qemu-action@v3 |
| 24 | + |
| 25 | + - name: Set up Docker Buildx |
| 26 | + uses: docker/setup-buildx-action@v3 |
| 27 | + |
| 28 | + - name: Build and docker image with tag |
| 29 | + uses: docker/build-push-action@v5 |
| 30 | + with: |
| 31 | + file: jdk-17/tf-deploy/Dockerfile |
| 32 | + load: true |
| 33 | + push: false |
| 34 | + tags: | |
| 35 | + ${{ secrets.DOCKERHUB_USERNAME }}/jenkins-slave-tf-deploy-jdk17-image:latest |
| 36 | +
|
| 37 | + - name: List files |
| 38 | + run: ls -la |
| 39 | + |
| 40 | + - name: Get software versions |
| 41 | + run: bash get_software_versions.sh |
| 42 | + |
| 43 | + - name: Build and docker image with latest tag |
| 44 | + uses: docker/build-push-action@v5 |
| 45 | + with: |
| 46 | + file: jdk-17/tf-deploy/Dockerfile |
| 47 | + push: true |
| 48 | + platforms: linux/amd64,linux/arm64 |
| 49 | + tags: | |
| 50 | + ${{ secrets.DOCKERHUB_USERNAME }}/jenkins-slave-tf-deploy-jdk17-image:latest |
| 51 | +
|
| 52 | + - name: Build wand docker image with tag |
| 53 | + uses: docker/build-push-action@v6 |
| 54 | + with: |
| 55 | + file: jdk-11/tf-deploy/Dockerfile |
| 56 | + push: true |
| 57 | + platforms: linux/amd64,linux/arm64 |
| 58 | + tags: | |
| 59 | + ${{ secrets.DOCKERHUB_USERNAME }}/jenkins-slave-tf-deploy-jdk17-image:tf_${{ env.TERRAFORM_VERSION }}_az_${{ env.AZ_CLI_VERSION }} |
| 60 | +
|
| 61 | + - name: set up docker and scan docker image for vulnerabilities |
| 62 | + uses: docker-practice/actions-setup-docker@master |
| 63 | + - run: | |
| 64 | + set -x |
| 65 | + docker version |
| 66 | + docker run -v /var/run/docker.sock:/var/run/docker.sock aquasec/trivy image ${{ secrets.DOCKERHUB_USERNAME }}/jenkins-slave-tf-deploy-jdk11-image:latest |
0 commit comments