Update all dependencies on GitHub Actions #2808
Workflow file for this run
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 container image | |
on: push | |
jobs: | |
build: | |
strategy: | |
matrix: | |
runs-on: | |
- "ubuntu-latest" | |
- "buildjet-2vcpu-ubuntu-2204-arm" | |
runs-on: ${{ matrix.runs-on }} | |
if: github.event.pusher.name != 'dreamkast-cloudnativedays' | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Set up Docker Buildx | |
id: buildx | |
uses: docker/setup-buildx-action@v2 | |
- name: Configure AWS Credentials | |
uses: aws-actions/configure-aws-credentials@v3 | |
with: | |
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} | |
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | |
aws-region: ap-northeast-1 | |
- name: Login to Amazon ECR | |
id: login-ecr | |
uses: aws-actions/amazon-ecr-login@v1 | |
- name: Docker meta | |
id: meta | |
uses: docker/metadata-action@v4 | |
with: | |
images: ${{ steps.login-ecr.outputs.registry }}/dreamkast-ecs | |
tags: | | |
type=sha,prefix=,format=long | |
type=ref,event=branch | |
- name: Prepare-tag | |
id: tags | |
run: | | |
arch="" | |
# https://docs.github.com/en/actions/learn-github-actions/contexts#runner-context | |
case "${{ runner.arch }}" in | |
"X64" ) arch="amd64" ;; | |
"ARM64" ) arch="arm64" ;; | |
esac | |
echo "tag=${{ github.sha }}-${arch}" >> $GITHUB_OUTPUT | |
- name: Build | |
id: docker_build | |
uses: docker/build-push-action@v4 | |
with: | |
context: ./ | |
file: ./Dockerfile | |
push: true | |
tags: ${{ steps.login-ecr.outputs.registry }}/dreamkast-ecs:${{ steps.tags.outputs.tag }} | |
provenance: false | |
labels: ${{ steps.meta.outputs.labels }} | |
cache-from: type=gha | |
cache-to: type=gha,mode=max | |
merge-images: | |
runs-on: "ubuntu-latest" | |
needs: ["build"] | |
steps: | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v2 | |
- name: Configure AWS Credentials | |
uses: aws-actions/configure-aws-credentials@v3 | |
with: | |
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} | |
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | |
aws-region: ap-northeast-1 | |
- name: Login to Amazon ECR | |
id: login-ecr | |
uses: aws-actions/amazon-ecr-login@v1 | |
- name: Docker meta | |
id: meta | |
uses: docker/metadata-action@v4 | |
with: | |
images: ${{ steps.login-ecr.outputs.registry }}/dreamkast-ecs | |
tags: | | |
type=ref,event=branch | |
- name: Create a New Image | |
run: | | |
image_tag_sha="${{ steps.login-ecr.outputs.registry }}/dreamkast-ecs:${{ github.sha }}" | |
image_tag_ref="${{ steps.meta.outputs.tags }}" | |
docker buildx imagetools create \ | |
--tag ${image_tag_ref} --tag ${image_tag_sha}\ | |
${image_tag_sha}-arm64 \ | |
${image_tag_sha}-amd64 | |
- name: Run Trivy vulnerability scanner | |
uses: aquasecurity/trivy-action@master | |
with: | |
image-ref: '${{ steps.login-ecr.outputs.registry }}/dreamkast-ecs:${{ github.sha }}' | |
format: 'table' | |
exit-code: '0' | |
ignore-unfixed: true | |
vuln-type: 'os,library' | |
severity: 'CRITICAL,HIGH' |