Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

update docker actions to latest stable #2652

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 8 additions & 5 deletions ci/docker-image.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,15 @@ on:
branches: [ $default-branch ]

jobs:

build:

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4
- name: Build the Docker image
run: docker build . --file Dockerfile --tag my-image-name:$(date +%s)
- name: Checkout repository
uses: actions/checkout@v4

- name: Build Docker image
uses: docker/build-push-action@48aba3b46d1b1fec4febb7c5d0c644b249a11355 # v6.10.0
with:
context: .
tags: my-image-name:latest
8 changes: 4 additions & 4 deletions ci/docker-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,13 +49,13 @@ jobs:
# multi-platform images and export cache
# https://github.com/docker/setup-buildx-action
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@f95db51fddba0c2d1ec667646a06c2ce06100226 # v3.0.0
uses: docker/setup-buildx-action@c47758b77c9736f4b2ef4073d4d51994fabfe349 # v3.7.1

# Login against a Docker registry except on PR
# https://github.com/docker/login-action
- name: Log into registry ${{ env.REGISTRY }}
if: github.event_name != 'pull_request'
uses: docker/login-action@343f7c4344506bcbf9b4de18042ae17996df046d # v3.0.0
uses: docker/login-action@9780b0c442fbb1117ed29e0efdff1e18412f7567 # v3.3.0
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
Expand All @@ -65,15 +65,15 @@ jobs:
# https://github.com/docker/metadata-action
- name: Extract Docker metadata
id: meta
uses: docker/metadata-action@96383f45573cb7f253c731d3b3ab81c87ef81934 # v5.0.0
uses: docker/metadata-action@369eb591f429131d6889c46b94e711f089e6ca96 # v5.6.1
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}

# Build and push Docker image with Buildx (don't push on PR)
# https://github.com/docker/build-push-action
- name: Build and push Docker image
id: build-and-push
uses: docker/build-push-action@0565240e2d4ab88bba5387d719585280857ece09 # v5.0.0
uses: docker/build-push-action@48aba3b46d1b1fec4febb7c5d0c644b249a11355 # v6.10.0
with:
context: .
push: ${{ github.event_name != 'pull_request' }}
Expand Down
7 changes: 6 additions & 1 deletion code-scanning/anchore-syft.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,13 @@ jobs:
steps:
- name: Checkout the code
uses: actions/checkout@v4

- name: Build the Docker image
run: docker build . --file Dockerfile --tag localbuild/testimage:latest
uses: docker/build-push-action@48aba3b46d1b1fec4febb7c5d0c644b249a11355 # v6.10.0
with:
context: .
tags: localbuild/testimage:latest

- name: Scan the image and upload dependency results
uses: anchore/sbom-action@bb716408e75840bbb01e839347cd213767269d4a
with:
Expand Down
8 changes: 7 additions & 1 deletion code-scanning/anchore.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,15 +33,21 @@ jobs:
steps:
- name: Check out the code
uses: actions/checkout@v4

- name: Build the Docker image
run: docker build . --file Dockerfile --tag localbuild/testimage:latest
uses: docker/build-push-action@48aba3b46d1b1fec4febb7c5d0c644b249a11355 # v6.10.0
with:
context: .
tags: localbuild/testimage:latest

- name: Run the Anchore Grype scan action
uses: anchore/scan-action@d5aa5b6cb9414b0c7771438046ff5bcfa2854ed7
id: scan
with:
image: "localbuild/testimage:latest"
fail-build: true
severity-cutoff: critical

- name: Upload vulnerability report
uses: github/codeql-action/upload-sarif@v3
with:
Expand Down
10 changes: 8 additions & 2 deletions code-scanning/snyk-container.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,13 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Build a Docker image
run: docker build -t your/image-to-test .

- name: Build Docker image
uses: docker/build-push-action@48aba3b46d1b1fec4febb7c5d0c644b249a11355 # v6.10.0
with:
context: .
tags: your/image-to-test

- name: Run Snyk to check Docker image for vulnerabilities
# Snyk can be used to break the build when it detects vulnerabilities.
# In this case we want to upload the issues to GitHub Code Scanning
Expand All @@ -49,6 +54,7 @@ jobs:
with:
image: your/image-to-test
args: --file=Dockerfile

- name: Upload result to GitHub Code Scanning
uses: github/codeql-action/upload-sarif@v3
with:
Expand Down
6 changes: 5 additions & 1 deletion code-scanning/snyk-security.yml
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,11 @@ jobs:

# Build the docker image for testing
- name: Build a Docker image
run: docker build -t your/image-to-test .
uses: docker/build-push-action@48aba3b46d1b1fec4febb7c5d0c644b249a11355 # v6.10.0
with:
context: .
tags: your/image-to-test

# Runs Snyk Container (Container and SCA) analysis and uploads result to Snyk.
- name: Snyk Container monitor
run: snyk container monitor your/image-to-test --file=Dockerfile
Expand Down
11 changes: 7 additions & 4 deletions code-scanning/sysdig-scan.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,13 @@ jobs:
steps:
- uses: actions/checkout@v4

- name: Build the Docker image
# Tag image to be built
# Change ${{ github.repository }} variable by another image name if you want but don't forget changing also image-tag below
run: docker build . --file Dockerfile --tag ${{ github.repository }}:latest
# Tag image to be built
# Change ${{ github.repository }} variable by another image name if you want but don't forget changing also image-tag below
- name: Build Docker image
uses: docker/build-push-action@48aba3b46d1b1fec4febb7c5d0c644b249a11355 # v6.10.0
with:
context: .
tags: ${{ github.repository }}:latest

- name: Sysdig Secure Inline Scan
id: scan
Expand Down
8 changes: 5 additions & 3 deletions code-scanning/trivy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,11 @@ jobs:
- name: Checkout code
uses: actions/checkout@v4

- name: Build an image from Dockerfile
run: |
docker build -t docker.io/my-organization/my-app:${{ github.sha }} .
- name: Build Docker image
uses: docker/build-push-action@48aba3b46d1b1fec4febb7c5d0c644b249a11355 # v6.10.0
with:
context: .
tags: docker.io/my-organization/my-app:${{ github.sha }}

- name: Run Trivy vulnerability scanner
uses: aquasecurity/trivy-action@7b7aa264d83dc58691451798b4d117d53d21edfe
Expand Down
17 changes: 11 additions & 6 deletions deployments/alibabacloud.yml
Original file line number Diff line number Diff line change
Expand Up @@ -61,9 +61,11 @@ jobs:

# 1.2 Build and push image to ACR
- name: Build and push image to ACR
run: |
docker build --tag "$REGISTRY/$NAMESPACE/$IMAGE:$TAG" .
docker push "$REGISTRY/$NAMESPACE/$IMAGE:$TAG"
uses: docker/build-push-action@48aba3b46d1b1fec4febb7c5d0c644b249a11355 # v6.10.0
with:
context: .
push: true
tags: ${{ env.REGISTRY }}/${{ env.NAMESPACE }}/${{ env.IMAGE }}:${{ env.TAG }}

# 1.3 Scan image in ACR
- name: Scan image in ACR
Expand All @@ -88,9 +90,12 @@ jobs:

# 2.2 (Optional) Build and push image ACR EE
- name: Build and push image to ACR EE
run: |
docker build -t "$ACR_EE_REGISTRY/$ACR_EE_NAMESPACE/$ACR_EE_IMAGE:$TAG" .
docker push "$ACR_EE_REGISTRY/$ACR_EE_NAMESPACE/$ACR_EE_IMAGE:$TAG"
uses: docker/build-push-action@48aba3b46d1b1fec4febb7c5d0c644b249a11355 # v6.10.0
with:
context: .
push: true
tags: ${{ env.ACR_EE_REGISTRY }}/${{ env.ACR_EE_NAMESPACE }}/${{ env.ACR_EE_IMAGE }}:${{ env.TAG }}

# 2.3 (Optional) Scan image in ACR EE
- name: Scan image in ACR EE
uses: aliyun/acr-scan@v1
Expand Down
18 changes: 6 additions & 12 deletions deployments/aws.yml
Original file line number Diff line number Diff line change
Expand Up @@ -65,25 +65,19 @@ jobs:
uses: aws-actions/amazon-ecr-login@v1

- name: Build, tag, and push image to Amazon ECR
id: build-image
env:
ECR_REGISTRY: ${{ steps.login-ecr.outputs.registry }}
IMAGE_TAG: ${{ github.sha }}
run: |
# Build a docker container and
# push it to ECR so that it can
# be deployed to ECS.
docker build -t $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG .
docker push $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG
echo "image=$ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG" >> $GITHUB_OUTPUT
uses: docker/build-push-action@48aba3b46d1b1fec4febb7c5d0c644b249a11355 # v6.10.0
with:
context: .
push: true
tags: ${{ steps.login-ecr.outputs.registry }}/${{ env.ECR_REPOSITORY }}:${{ github.sha }}

- name: Fill in the new image ID in the Amazon ECS task definition
id: task-def
uses: aws-actions/amazon-ecs-render-task-definition@v1
with:
task-definition: ${{ env.ECS_TASK_DEFINITION }}
container-name: ${{ env.CONTAINER_NAME }}
image: ${{ steps.build-image.outputs.image }}
image: ${{ steps.login-ecr.outputs.registry }}/${{ env.ECR_REPOSITORY }}:${{ github.sha }}

- name: Deploy Amazon ECS task definition
uses: aws-actions/amazon-ecs-deploy-task-definition@v1
Expand Down
7 changes: 4 additions & 3 deletions deployments/azure-container-webapp.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,10 +45,10 @@ jobs:
- uses: actions/checkout@v4

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@f95db51fddba0c2d1ec667646a06c2ce06100226 # v3.0.0
uses: docker/setup-buildx-action@c47758b77c9736f4b2ef4073d4d51994fabfe349 # v3.7.1

- name: Log in to GitHub container registry
uses: docker/login-action@343f7c4344506bcbf9b4de18042ae17996df046d # v3.0.0
uses: docker/login-action@9780b0c442fbb1117ed29e0efdff1e18412f7567 # v3.3.0
with:
registry: ghcr.io
username: ${{ github.actor }}
Expand All @@ -58,8 +58,9 @@ jobs:
run: echo "REPO=${GITHUB_REPOSITORY,,}" >>${GITHUB_ENV}

- name: Build and push container image to registry
uses: docker/build-push-action@0565240e2d4ab88bba5387d719585280857ece09 # v5.0.0
uses: docker/build-push-action@48aba3b46d1b1fec4febb7c5d0c644b249a11355 # v6.10.0
with:
context: .
push: true
tags: ghcr.io/${{ env.REPO }}:${{ github.sha }}
file: ./Dockerfile
Expand Down
11 changes: 5 additions & 6 deletions deployments/azure-functions-app-container.yml
Original file line number Diff line number Diff line change
Expand Up @@ -55,12 +55,11 @@ jobs:
password: ${{ secrets.REGISTRY_PASSWORD }}

- name: 'Compose Customized Docker Image'
shell: bash
run: |
# If your function app project is not located in your repository's root
# Please change the path to your directory for docker build
docker build . -t ${{ env.REGISTRY }}/${{ env.NAMESPACE }}/${{ env.IMAGE }}:${{ env.TAG }}
docker push ${{ env.REGISTRY }}/${{ env.NAMESPACE }}/${{ env.IMAGE }}:${{ env.TAG }}
uses: docker/build-push-action@48aba3b46d1b1fec4febb7c5d0c644b249a11355 # v6.10.0
with:
context: .
push: true
tags: ${{ env.REGISTRY }}/${{ env.NAMESPACE }}/${{ env.IMAGE }}:${{ env.TAG }}

- name: 'Run Azure Functions Container Action'
uses: Azure/functions-container-action@v1
Expand Down
10 changes: 6 additions & 4 deletions deployments/google-cloudrun-docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -73,10 +73,12 @@ jobs:
registry: '${{ env.REGION }}-docker.pkg.dev'

- name: 'Build and Push Container'
run: |-
DOCKER_TAG="$${{ env.REGION }}-docker.pkg.dev/${{ env.PROJECT_ID }}/${{ env.SERVICE }}:${{ github.sha }}"
docker build --tag "${DOCKER_TAG}" .
docker push "${DOCKER_TAG}"
uses: docker/build-push-action@48aba3b46d1b1fec4febb7c5d0c644b249a11355 # v6.10.0
with:
context: .
push: true
tags: ${{ env.REGION }}-docker.pkg.dev/${{ env.PROJECT_ID }}/${{ env.SERVICE }}:${{ github.sha }}

- name: 'Deploy to Cloud Run'

# END - Docker auth and build
Expand Down
20 changes: 9 additions & 11 deletions deployments/google.yml
Original file line number Diff line number Diff line change
Expand Up @@ -88,17 +88,15 @@ jobs:
location: '${{ env.GKE_ZONE }}'

# Build the Docker image
- name: 'Build and push Docker container'
run: |-
DOCKER_TAG="${GAR_LOCATION}-docker.pkg.dev/${PROJECT_ID}/${REPOSITORY}/${IMAGE}:${GITHUB_SHA}"

docker build \
--tag "${DOCKER_TAG}" \
--build-arg GITHUB_SHA="${GITHUB_SHA}" \
--build-arg GITHUB_REF="${GITHUB_REF}" \
.

docker push "${DOCKER_TAG}"
- name: Build and push Docker container
uses: docker/build-push-action@48aba3b46d1b1fec4febb7c5d0c644b249a11355 # v6.10.0
with:
context: .
push: true
tags: ${{ env.GAR_LOCATION }}-docker.pkg.dev/${{ env.PROJECT_ID }}/${{ env.REPOSITORY }}/${{ env.IMAGE }}:${{ env.GITHUB_SHA }}
build-args: |
GITHUB_SHA=${{ env.GITHUB_SHA }}
GITHUB_REF=${{ env.GITHUB_REF }}

# Set up kustomize
- name: 'Set up Kustomize'
Expand Down
19 changes: 9 additions & 10 deletions deployments/ibm.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,16 +51,15 @@ jobs:
ibmcloud cr login

# Build the Docker image
- name: Build with Docker
run: |
docker build -t "$REGISTRY_HOSTNAME"/"$ICR_NAMESPACE"/"$IMAGE_NAME":"$GITHUB_SHA" \
--build-arg GITHUB_SHA="$GITHUB_SHA" \
--build-arg GITHUB_REF="$GITHUB_REF" .

# Push the image to IBM Container Registry
- name: Push the image to ICR
run: |
docker push $REGISTRY_HOSTNAME/$ICR_NAMESPACE/$IMAGE_NAME:$GITHUB_SHA
- name: Build and push with Docker
uses: docker/build-push-action@48aba3b46d1b1fec4febb7c5d0c644b249a11355 # v6.10.0
with:
context: .
push: true
tags: ${{ env.REGISTRY_HOSTNAME }}/${{ env.ICR_NAMESPACE }}/${{ env.IMAGE_NAME }}:${{ env.GITHUB_SHA }}
build-args: |
GITHUB_SHA=${{ env.GITHUB_SHA }}
GITHUB_REF=${{ env.GITHUB_REF }}

# Deploy the Docker image to the IKS cluster
- name: Deploy to IKS
Expand Down
22 changes: 11 additions & 11 deletions deployments/tencent.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,19 +39,19 @@ jobs:
- name: Checkout
uses: actions/checkout@v4

# Build
- name: Build Docker image
run: |
docker build -t ${TKE_IMAGE_URL}:${GITHUB_SHA} .

- name: Login TKE Registry
run: |
docker login -u ${{ secrets.TENCENT_CLOUD_ACCOUNT_ID }} -p '${{ secrets.TKE_REGISTRY_PASSWORD }}' ${TKE_IMAGE_URL}
uses: docker/login-action@9780b0c442fbb1117ed29e0efdff1e18412f7567 # v3.3.0
with:
registry: ${{ env.TKE_IMAGE_URL }}
username: ${{ secrets.TENCENT_CLOUD_ACCOUNT_ID }}
password: ${{ secrets.TKE_REGISTRY_PASSWORD }}

# Push the Docker image to TKE Registry
- name: Publish
run: |
docker push ${TKE_IMAGE_URL}:${GITHUB_SHA}
- name: Build and push Docker image
uses: docker/build-push-action@48aba3b46d1b1fec4febb7c5d0c644b249a11355 # v6.10.0
with:
context: .
push: true
tags: ${{ env.TKE_IMAGE_URL }}:${{ env.GITHUB_SHA }}

- name: Set up Kustomize
run: |
Expand Down
Loading