Compare commits
2 Commits
209d6cdef8
...
77c40c879c
| Author | SHA1 | Date | |
|---|---|---|---|
| 77c40c879c | |||
| a8cc214bf8 |
@@ -3,16 +3,16 @@ description: "Build and deploy images"
|
||||
|
||||
inputs:
|
||||
registry_addr:
|
||||
description: ""
|
||||
description: registry address
|
||||
required: true
|
||||
registry_username:
|
||||
description: ""
|
||||
description: "registry username"
|
||||
required: true
|
||||
registry_password:
|
||||
description: ""
|
||||
description: "registry password"
|
||||
required: true
|
||||
buildkit_addr:
|
||||
description: ""
|
||||
description: "buildkit address"
|
||||
required: true
|
||||
default: "false"
|
||||
name:
|
||||
@@ -20,11 +20,11 @@ inputs:
|
||||
required: true
|
||||
default: "false"
|
||||
context:
|
||||
description: ""
|
||||
required: true
|
||||
default: "false"
|
||||
description: "buildctl build context"
|
||||
required: false
|
||||
default: "."
|
||||
dockerfile:
|
||||
description: ""
|
||||
description: "buildctl build dockerfile/folder"
|
||||
required: true
|
||||
default: "false"
|
||||
runs:
|
||||
@@ -33,10 +33,21 @@ runs:
|
||||
- name: Authenticate to Gitea registry
|
||||
shell: bash
|
||||
run: |
|
||||
mkdir -p ~/.docker
|
||||
AUTH=$(printf "%s" "${{ inputs.registry_username }}:${{ inputs.registry_password }}" | base64 -w 0)
|
||||
printf '{"auths":{"${{ inputs.registry_addr }}":{"auth":"%s"}}}' "$AUTH" > ~/.docker/config.json
|
||||
Create a temporary file inside GITHUB_TEMP
|
||||
DOCKER_CONFIG_FILE="${GITHUB_TEMP}/docker_config.json"
|
||||
|
||||
# Ensure cleanup ALWAYS happens
|
||||
trap 'rm -f "$DOCKER_CONFIG_FILE"' EXIT
|
||||
|
||||
# Generate auth entry
|
||||
AUTH=$(printf "%s" "${{ inputs.registry_username }}:${{ inputs.registry_password }}" | base64 -w 0)
|
||||
|
||||
printf '{"auths":{"%s":{"auth":"%s"}}}' \
|
||||
"${{ inputs.registry_addr }}" \
|
||||
"$AUTH" \
|
||||
> "$DOCKER_CONFIG_FILE"
|
||||
|
||||
# Run BuildKit build
|
||||
buildctl \
|
||||
--addr ${{ inputs.buildkit_addr }} \
|
||||
build \
|
||||
@@ -44,4 +55,5 @@ runs:
|
||||
--local context=${{ inputs.context }} \
|
||||
--local dockerfile=${{ inputs.dockerfile }} \
|
||||
--opt filename=Dockerfile \
|
||||
--output type=image,name=${{ inputs.tags }},push=true
|
||||
--output type=image,name=${{ inputs.tags }},push=true,registry.config=$DOCKER_CONFIG_FILE
|
||||
|
||||
|
||||
Reference in New Issue
Block a user