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
|
||||
description: "Build and deploy images"
|
||||
|
||||
name: BuildKit Build and push
|
||||
description: "Build and push images using remote Buildkit"
|
||||
inputs:
|
||||
registry_addr:
|
||||
registry_addr:
|
||||
description: registry address
|
||||
required: true
|
||||
registry_username:
|
||||
@@ -24,15 +23,19 @@ inputs:
|
||||
dockerfile:
|
||||
description: "buildctl build dockerfile/folder"
|
||||
required: true
|
||||
default: "."
|
||||
default: "."
|
||||
filename:
|
||||
description: "Docker file name (Default: Dockerfile)"
|
||||
required: true
|
||||
default: "Dockerfile"
|
||||
default: "Dockerfile"
|
||||
build_args:
|
||||
description: "Build arguments (multiline KEY=VALUE)"
|
||||
required: false
|
||||
default: ""
|
||||
runs:
|
||||
using: "composite"
|
||||
steps:
|
||||
- name: run buildctl built and push
|
||||
- name: run buildctl build and push
|
||||
shell: bash
|
||||
run: |
|
||||
|
||||
@@ -43,7 +46,6 @@ runs:
|
||||
# clean up
|
||||
trap 'rm -rf "$DOCKER_CONFIG_DIR"' EXIT
|
||||
|
||||
|
||||
# setup file docker config (auth) temp file
|
||||
AUTH=$(printf "%s" "${{ inputs.registry_username }}:${{ inputs.registry_password }}" | base64 -w 0)
|
||||
cat > "$DOCKER_CONFIG_DIR/config.json" <<EOF
|
||||
@@ -56,7 +58,16 @@ runs:
|
||||
}
|
||||
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 \
|
||||
--addr ${{ inputs.buildkit_addr }} \
|
||||
build \
|
||||
@@ -64,6 +75,7 @@ runs:
|
||||
--local context=${{ inputs.context }} \
|
||||
--local dockerfile=${{ inputs.dockerfile }} \
|
||||
--opt filename=${{ inputs.filename }} \
|
||||
$BUILD_ARG_FLAGS \
|
||||
--output type=image,name=${{ inputs.tags }},push=true
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user