Skip to content
Merged
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
64 changes: 34 additions & 30 deletions action.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
name: 'Docker build and push'
description: 'Simple Docker build and push action'
name: "Docker build and push"
description: "Simple Docker build and push action"
author: hello@cloudposse.com
branding:
icon: 'box'
color: 'white'
icon: "box"
color: "white"
inputs:
allow:
description: "List of extra privileged entitlement (e.g., network.host,security.insecure)"
Expand All @@ -15,60 +15,60 @@ inputs:
description: "List of additional build contexts (e.g., name=path)"
required: false
buildkitd-flags:
description: 'BuildKit daemon flags'
default: '--allow-insecure-entitlement security.insecure --allow-insecure-entitlement network.host'
description: "BuildKit daemon flags"
default: "--allow-insecure-entitlement security.insecure --allow-insecure-entitlement network.host"
required: false
driver-opts:
description: 'List of additional driver-specific options. (eg. image=moby/buildkit:master)'
description: "List of additional driver-specific options. (eg. image=moby/buildkit:master)"
required: false
default: image=public.ecr.aws/vend/moby/buildkit:buildx-stable-1
binfmt-image:
description: 'Binfmt image'
description: "Binfmt image"
required: false
default: public.ecr.aws/eks-distro-build-tooling/binfmt-misc:qemu-v7.0.0
workdir:
description: 'Working directory'
description: "Working directory"
required: false
default: './'
default: "./"
file:
description: 'Dockerfile name'
description: "Dockerfile name"
required: false
default: 'Dockerfile'
default: "Dockerfile"
build-args:
description: "List of build-time variables"
required: false
organization:
description: 'Organization'
description: "Organization"
required: true
repository:
description: 'Repository'
description: "Repository"
required: true
registry:
description: 'Docker registry'
description: "Docker registry"
required: true
target:
description: "Sets the target stage to build"
required: false
default: ''
default: ""
platforms:
description: "List of target platforms for build (e.g. linux/amd64,linux/arm64,linux/riscv64,linux/ppc64le,linux/s390x,etc)"
required: false
default: 'linux/amd64'
default: "linux/amd64"
provenance:
description: "Generate provenance attestation for the build"
required: false
image_name:
description: "Image name (excluding registry). Defaults to {{$organization/$repository}}."
required: false
default: ''
default: ""
login:
description: 'Docker login'
description: "Docker login"
required: false
default: ''
default: ""
password:
description: 'Docker password'
description: "Docker password"
required: false
default: ''
default: ""
cache-from:
description: "List of external cache sources for buildx (e.g., user/app:cache, type=local,src=path/to/dir)"
required: false
Expand Down Expand Up @@ -159,11 +159,11 @@ runs:
labels: |
org.opencontainers.image.source=https://github.com/${{ inputs.organization }}/${{ inputs.repository }}

- name: 'Install jq 1.6'
- name: "Install jq 1.6"
uses: dcarbone/install-jq-action@v3.2.0
with:
version: 1.6
force: 'true'
force: "true"

# here we set the first tag in the output as the output of this step
# this order is determined by the priority, we set the sha as 1001, as that is 1 above the defaults
Expand Down Expand Up @@ -195,7 +195,7 @@ runs:
uses: docker/setup-buildx-action@v3
with:
endpoint: buildx-context
buildkitd-flags: "${{ inputs.debug == 'true' && '--debug' || '' }} ${{ inputs.buildkitd-flags }}"
buildkitd-flags: "${{ inputs.debug == 'true' && '--debug' || '' }} ${{ inputs.buildkitd-flags }}"
driver-opts: "${{ inputs.driver-opts }}"

- name: Login
Expand All @@ -206,7 +206,6 @@ runs:
username: ${{ inputs.login }}
password: ${{ inputs.password }}


- name: Build and push Docker images
# Do not update to >=v6 untill the issue would be solved
# https://github.com/docker/build-push-action/issues/1167
Expand Down Expand Up @@ -236,17 +235,22 @@ runs:
- name: Get Metadata
id: get-metadata
shell: bash
env:
METADATA: ${{ toJSON(steps.docker-build-push-action.outputs.metadata) }}
run: |
metadata=$(echo '${{ steps.docker-build-push-action.outputs.metadata }}' | jq -c)
echo "metadata=$metadata" >> $GITHUB_OUTPUT
{
echo "metadata<<EOF"
echo "$METADATA"
echo "EOF"
} >> $GITHUB_OUTPUT
echo "## Docker Image Metadata" >> $GITHUB_STEP_SUMMARY
echo '```json' >> $GITHUB_STEP_SUMMARY
echo "$metadata" | jq >> $GITHUB_STEP_SUMMARY
echo "$METADATA" | jq >> $GITHUB_STEP_SUMMARY
echo '```' >> $GITHUB_STEP_SUMMARY

- name: Docker Inspect
id: inspect
if: ${{ inputs.inspect }} == 'true'
if: ${{ inputs.inspect }} == 'true'
shell: bash
run: |
docker pull "${{ inputs.registry }}/${{ steps.image_name.outputs.image_name }}:${{ steps.tag.outputs.output }}"
Expand Down