feat: limbo_actions/buildkit-build-push: added build_args argument
All checks were successful
/ build-docker-image (push) Successful in 14s
All checks were successful
/ build-docker-image (push) Successful in 14s
This commit is contained in:
@@ -1,8 +1,7 @@
|
|||||||
name: BuildKit Build and Deploys
|
name: BuildKit Build and push
|
||||||
description: "Build and deploy images"
|
description: "Build and push images using remote Buildkit"
|
||||||
|
|
||||||
inputs:
|
inputs:
|
||||||
registry_addr:
|
registry_addr:
|
||||||
description: registry address
|
description: registry address
|
||||||
required: true
|
required: true
|
||||||
registry_username:
|
registry_username:
|
||||||
@@ -24,15 +23,19 @@ inputs:
|
|||||||
dockerfile:
|
dockerfile:
|
||||||
description: "buildctl build dockerfile/folder"
|
description: "buildctl build dockerfile/folder"
|
||||||
required: true
|
required: true
|
||||||
default: "."
|
default: "."
|
||||||
filename:
|
filename:
|
||||||
description: "Docker file name (Default: Dockerfile)"
|
description: "Docker file name (Default: Dockerfile)"
|
||||||
required: true
|
required: true
|
||||||
default: "Dockerfile"
|
default: "Dockerfile"
|
||||||
|
build_args:
|
||||||
|
description: "Build arguments (multiline KEY=VALUE)"
|
||||||
|
required: false
|
||||||
|
default: ""
|
||||||
runs:
|
runs:
|
||||||
using: "composite"
|
using: "composite"
|
||||||
steps:
|
steps:
|
||||||
- name: run buildctl built and push
|
- name: run buildctl build and push
|
||||||
shell: bash
|
shell: bash
|
||||||
run: |
|
run: |
|
||||||
|
|
||||||
@@ -43,7 +46,6 @@ runs:
|
|||||||
# clean up
|
# clean up
|
||||||
trap 'rm -rf "$DOCKER_CONFIG_DIR"' EXIT
|
trap 'rm -rf "$DOCKER_CONFIG_DIR"' EXIT
|
||||||
|
|
||||||
|
|
||||||
# setup file docker config (auth) temp file
|
# setup file docker config (auth) temp file
|
||||||
AUTH=$(printf "%s" "${{ inputs.registry_username }}:${{ inputs.registry_password }}" | base64 -w 0)
|
AUTH=$(printf "%s" "${{ inputs.registry_username }}:${{ inputs.registry_password }}" | base64 -w 0)
|
||||||
cat > "$DOCKER_CONFIG_DIR/config.json" <<EOF
|
cat > "$DOCKER_CONFIG_DIR/config.json" <<EOF
|
||||||
@@ -56,7 +58,16 @@ runs:
|
|||||||
}
|
}
|
||||||
EOF
|
EOF
|
||||||
|
|
||||||
# Run BuildKit build, set DOCKER_CONFIG to DOCKER_CONFIG_DIR so auth works on push
|
# Build build-arg flags
|
||||||
|
BUILD_ARG_FLAGS=""
|
||||||
|
while IFS= read -r line; do
|
||||||
|
[[ -z "$line" ]] && continue
|
||||||
|
BUILD_ARG_FLAGS="$BUILD_ARG_FLAGS --opt build-arg:${line}"
|
||||||
|
done <<< "${{ inputs.build_args }}"
|
||||||
|
|
||||||
|
echo "Using build args: $BUILD_ARG_FLAGS"
|
||||||
|
|
||||||
|
# Run BuildKit build
|
||||||
DOCKER_CONFIG=$DOCKER_CONFIG_DIR buildctl \
|
DOCKER_CONFIG=$DOCKER_CONFIG_DIR buildctl \
|
||||||
--addr ${{ inputs.buildkit_addr }} \
|
--addr ${{ inputs.buildkit_addr }} \
|
||||||
build \
|
build \
|
||||||
@@ -64,6 +75,7 @@ runs:
|
|||||||
--local context=${{ inputs.context }} \
|
--local context=${{ inputs.context }} \
|
||||||
--local dockerfile=${{ inputs.dockerfile }} \
|
--local dockerfile=${{ inputs.dockerfile }} \
|
||||||
--opt filename=${{ inputs.filename }} \
|
--opt filename=${{ inputs.filename }} \
|
||||||
|
$BUILD_ARG_FLAGS \
|
||||||
--output type=image,name=${{ inputs.tags }},push=true
|
--output type=image,name=${{ inputs.tags }},push=true
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user