Skip to content

Docker Build and Publish #87

Docker Build and Publish

Docker Build and Publish #87

name: Docker Build and Publish
on:
workflow_dispatch:
push:
branches: ["main"]
paths:
- "images/**"
schedule:
- cron: "0 2 * * 0" # Weekly on Sundays at 02:00
permissions:
contents: read
packages: write
id-token: write
env:
IMAGE_TAG: 1.0.${{ github.run_number }}
jobs:
# standard-alpine:
# name: Build standard-alpine-amd64
# runs-on: ubuntu-latest
# steps:
# - uses: actions/checkout@v3
# - name: Build the Docker image
# run: docker build . --file images/standard-alpine-amd64/Dockerfile --no-cache -t standard-alpine-amd64:${{ github.sha }}
# - name: Run Trivy vulnerability scanner
# uses: aquasecurity/trivy-action@master
# with:
# image-ref: "standard-alpine-amd64:${{ github.sha }}"
# format: "table"
# exit-code: "1"
# ignore-unfixed: true
# severity: "CRITICAL,HIGH"
# hide-progress: true
# vuln-type: "os"
# - uses: actions/checkout@v3
# - name: Docker Image Size
# run: docker inspect -f "{{ .Size }}" standard-alpine-amd64:${{ github.sha }} | numfmt --to=si
# - name: Publish to Registry
# id: publish-standard-alpine-amd64
# uses: elgohr/Publish-Docker-Github-Action@v5
# with:
# name: SlalomBuild/pe-toolkit-standard-alpine-amd64
# username: ${{ github.actor }}
# password: ${{ secrets.GITHUB_TOKEN }}
# registry: ghcr.io
# buildoptions: "--compress --force-rm"
# dockerfile: images/standard-alpine-amd64/Dockerfile
# platforms: linux/amd64
# tags: "latest,${{ env.IMAGE_TAG }}"
standard-ubuntu:
name: Build standard-ubuntu-aarch64
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Build the Docker image
run: docker buildx . --file images/standard-ubuntu-amd64/Dockerfile --no-cache -t standard-ubuntu-amd64:${{ github.sha }} --platform linux/aarch64
# - name: Run Trivy vulnerability scanner
# uses: aquasecurity/trivy-action@master
# with:
# image-ref: "standard-ubuntu-amd64:${{ github.sha }}"
# format: "table"
# exit-code: "1"
# ignore-unfixed: true
# severity: "CRITICAL,HIGH"
# hide-progress: true
# vuln-type: "os"
- uses: actions/checkout@v3
- name: Docker Image Size
run: docker inspect -f "{{ .Size }}" standard-ubuntu-amd64:${{ github.sha }} | numfmt --to=si
- name: Publish to Registry
id: publish-standard-ubuntu-amd64
uses: elgohr/Publish-Docker-Github-Action@v5
with:
name: SlalomBuild/pe-toolkit-standard-ubuntu-aarch64
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
registry: ghcr.io
buildoptions: "--compress --force-rm"
dockerfile: images/standard-ubuntu-aarch64/Dockerfile
platforms: linux/aarch64
tags: "latest,${{ env.IMAGE_TAG }}"
# standard-ubuntu:
# name: Build standard-ubuntu-amd64
# runs-on: ubuntu-latest
# steps:
# - uses: actions/checkout@v3
# - name: Build the Docker image
# run: docker build . --file images/standard-ubuntu-amd64/Dockerfile --no-cache -t standard-ubuntu-amd64:${{ github.sha }}
# - name: Run Trivy vulnerability scanner
# uses: aquasecurity/trivy-action@master
# with:
# image-ref: "standard-ubuntu-amd64:${{ github.sha }}"
# format: "table"
# exit-code: "1"
# ignore-unfixed: true
# severity: "CRITICAL,HIGH"
# hide-progress: true
# vuln-type: "os"
# - uses: actions/checkout@v3
# - name: Docker Image Size
# run: docker inspect -f "{{ .Size }}" standard-ubuntu-amd64:${{ github.sha }} | numfmt --to=si
# - name: Publish to Registry
# id: publish-standard-ubuntu-amd64
# uses: elgohr/Publish-Docker-Github-Action@v5
# with:
# name: SlalomBuild/pe-toolkit-standard-ubuntu-amd64
# username: ${{ github.actor }}
# password: ${{ secrets.GITHUB_TOKEN }}
# registry: ghcr.io
# buildoptions: "--compress --force-rm"
# dockerfile: images/standard-ubuntu-amd64/Dockerfile
# platforms: linux/amd64
# tags: "latest,${{ env.IMAGE_TAG }}"
# full-alpine:
# name: Build full-alpine-amd64
# runs-on: ubuntu-latest
# steps:
# - uses: actions/checkout@v3
# - name: Build the Docker image
# run: docker build . --file images/full-alpine-amd64/Dockerfile --no-cache -t full-alpine-amd64:${{ github.sha }}
# - name: Run Trivy vulnerability scanner
# uses: aquasecurity/trivy-action@master
# with:
# image-ref: "full-alpine-amd64:${{ github.sha }}"
# format: "table"
# exit-code: "1"
# ignore-unfixed: true
# severity: "CRITICAL,HIGH"
# hide-progress: true
# vuln-type: "os"
# - uses: actions/checkout@v3
# - name: Docker Image Size
# run: docker inspect -f "{{ .Size }}" full-alpine-amd64:${{ github.sha }} | numfmt --to=si
# - name: Publish to Registry
# uses: elgohr/Publish-Docker-Github-Action@v5
# with:
# name: SlalomBuild/pe-toolkit-full-alpine-amd64
# username: ${{ github.actor }}
# password: ${{ secrets.GITHUB_TOKEN }}
# registry: ghcr.io
# buildoptions: "--compress --force-rm"
# dockerfile: images/full-alpine-amd64/Dockerfile
# platforms: linux/amd64
# tags: "latest,${{ env.IMAGE_TAG }}"
# full-ubuntu:
# name: Build full-ubuntu-amd64
# runs-on: ubuntu-latest
# steps:
# - uses: actions/checkout@v3
# - name: Build the Docker image
# run: docker build . --file images/full-ubuntu-amd64/Dockerfile --no-cache -t full-ubuntu-amd64:${{ github.sha }}
# - name: Run Trivy vulnerability scanner
# uses: aquasecurity/trivy-action@master
# with:
# image-ref: "full-ubuntu-amd64:${{ github.sha }}"
# format: "table"
# exit-code: "1"
# ignore-unfixed: true
# severity: "CRITICAL,HIGH"
# hide-progress: true
# vuln-type: "os"
# - uses: actions/checkout@v3
# - name: Docker Image Size
# run: docker inspect -f "{{ .Size }}" full-ubuntu-amd64:${{ github.sha }} | numfmt --to=si
# - name: Publish to Registry
# uses: elgohr/Publish-Docker-Github-Action@v5
# with:
# name: SlalomBuild/pe-toolkit-full-ubuntu-amd64
# username: ${{ github.actor }}
# password: ${{ secrets.GITHUB_TOKEN }}
# registry: ghcr.io
# buildoptions: "--compress --force-rm"
# dockerfile: images/full-ubuntu-amd64/Dockerfile
# platforms: linux/amd64
# tags: "latest,${{ env.IMAGE_TAG }}"
# test-standard-alpine:
# name: Test standard-alpine-amd64
# runs-on: ubuntu-latest
# container:
# image: ghcr.io/slalombuild/pe-toolkit-standard-alpine-amd64:1.0.${{ github.run_number }}
# credentials:
# username: ${{ github.actor }}
# password: ${{ secrets.GITHUB_TOKEN }}
# needs: standard-alpine
# if: ${{ success() }}
# steps:
# - name: Run each tool
# run: |
# figlet terraform && terraform version
# figlet atmos && atmos version
# figlet tflint && tflint --version
# figlet tfsec && tfsec --version
# figlet opa && opa version
# test-full-alpine:
# name: Test full-alpine-amd64
# runs-on: ubuntu-latest
# container:
# image: ghcr.io/slalombuild/pe-toolkit-full-alpine-amd64:1.0.${{ github.run_number }}
# credentials:
# username: ${{ github.actor }}
# password: ${{ secrets.GITHUB_TOKEN }}
# needs: full-alpine
# if: ${{ success() }}
# steps:
# - name: Run each tool
# run: |
# figlet terraform && terraform version
# figlet atmos && atmos version
# figlet tflint && tflint --version
# figlet tfsec && tfsec --version
# figlet opa && opa version
# test-standard-ubuntu:
# name: Test standard-ubuntu-amd64
# runs-on: ubuntu-latest
# container:
# image: ghcr.io/slalombuild/pe-toolkit-standard-ubuntu-amd64:1.0.${{ github.run_number }}
# credentials:
# username: ${{ github.actor }}
# password: ${{ secrets.GITHUB_TOKEN }}
# needs: standard-ubuntu
# if: ${{ success() }}
# steps:
# - name: Run each tool
# run: |
# figlet terraform && terraform version
# figlet atmos && atmos version
# figlet tflint && tflint --version
# figlet tfsec && tfsec --version
# figlet opa && opa version
# test-full-ubuntu:
# name: Test full-ubuntu-amd64
# runs-on: ubuntu-latest
# container:
# image: ghcr.io/slalombuild/pe-toolkit-full-ubuntu-amd64:1.0.${{ github.run_number }}
# credentials:
# username: ${{ github.actor }}
# password: ${{ secrets.GITHUB_TOKEN }}
# needs: full-ubuntu
# if: ${{ success() }}
# steps:
# - name: Run each tool
# run: |
# figlet terraform && terraform version
# figlet atmos && atmos version
# figlet tflint && tflint --version
# figlet tfsec && tfsec --version
# figlet opa && opa version