modified: .gitea/actions/buildkit-build-push-dev/action.yaml
This commit is contained in:
@@ -38,50 +38,51 @@ runs:
|
||||
- name: run buildctl build and push
|
||||
shell: bash
|
||||
run: |
|
||||
###############################################
|
||||
# Create DOCKER_CONFIG for this pipeline
|
||||
###############################################
|
||||
###############################################
|
||||
# Create DOCKER_CONFIG for this pipeline
|
||||
###############################################
|
||||
|
||||
DOCKER_CONFIG_DIR="${RUNNER_TEMP}/.buildctl_docker"
|
||||
mkdir -p "$DOCKER_CONFIG_DIR"
|
||||
DOCKER_CONFIG_DIR="${RUNNER_TEMP}/.buildctl_docker"
|
||||
mkdir -p "$DOCKER_CONFIG_DIR"
|
||||
|
||||
trap 'rm -rf "$DOCKER_CONFIG_DIR"' EXIT
|
||||
trap 'rm -rf "$DOCKER_CONFIG_DIR"' EXIT
|
||||
|
||||
AUTH=$(printf "%s:%s" "${{ inputs.registry_username }}" "${{ inputs.registry_password }}" | base64 -w0)
|
||||
AUTH=$(printf "%s:%s" "${{ inputs.registry_username }}" "${{ inputs.registry_password }}" | base64 -w0)
|
||||
|
||||
cat > "$DOCKER_CONFIG_DIR/config.json" <<EOF
|
||||
{
|
||||
"auths": {
|
||||
"${{ inputs.registry_addr }}": {
|
||||
"auth": "$AUTH"
|
||||
cat > "$DOCKER_CONFIG_DIR/config.json" <<EOF
|
||||
{
|
||||
"auths": {
|
||||
"${{ inputs.registry_addr }}": {
|
||||
"auth": "$AUTH"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
EOF
|
||||
EOF
|
||||
|
||||
###############################################
|
||||
# Build args
|
||||
###############################################
|
||||
###############################################
|
||||
# Build args
|
||||
###############################################
|
||||
|
||||
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 }}"
|
||||
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"
|
||||
echo "Using build args: $BUILD_ARG_FLAGS"
|
||||
|
||||
###############################################
|
||||
# Build + push using BuildKit REMOTE + SECRET
|
||||
###############################################
|
||||
###############################################
|
||||
# Build + push using BuildKit REMOTE + SECRET
|
||||
###############################################
|
||||
|
||||
buildctl \
|
||||
--addr ${{ inputs.buildkit_addr }} \
|
||||
build \
|
||||
--frontend=dockerfile.v0 \
|
||||
--local context=${{ inputs.context }} \
|
||||
--local dockerfile=${{ inputs.dockerfile }} \
|
||||
--opt filename=${{ inputs.filename }} \
|
||||
$BUILD_ARG_FLAGS \
|
||||
--secret id=harbor,src=$DOCKER_CONFIG_DIR/config.json \
|
||||
--output type=image,name=${{ inputs.tags }},push=true
|
||||
buildctl \
|
||||
--addr ${{ inputs.buildkit_addr }} \
|
||||
build \
|
||||
--frontend=dockerfile.v0 \
|
||||
--local context=${{ inputs.context }} \
|
||||
--local dockerfile=${{ inputs.dockerfile }} \
|
||||
--opt filename=${{ inputs.filename }} \
|
||||
$BUILD_ARG_FLAGS \
|
||||
--secret id=harbor,src=$DOCKER_CONFIG_DIR/config.json \
|
||||
--opt secret=harbor \
|
||||
--output type=image,name=${{ inputs.tags }},push=true
|
||||
Reference in New Issue
Block a user