Compare commits
7 Commits
950726553c
...
main
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
1bfab7df29 | ||
|
|
d5cf6786af | ||
|
|
b518f33ddf | ||
|
|
9786c305a0 | ||
|
|
8a83e7e9c1 | ||
| f77bd8935a | |||
|
|
febfe17222 |
@@ -1,57 +0,0 @@
|
||||
name: BuildKit Build and Deploys
|
||||
description: "Build and deploy images"
|
||||
|
||||
inputs:
|
||||
registry_addr:
|
||||
description: registry address
|
||||
required: true
|
||||
registry_username:
|
||||
description: "registry username"
|
||||
required: true
|
||||
registry_password:
|
||||
description: "registry password"
|
||||
required: true
|
||||
buildkit_addr:
|
||||
description: "buildkit address"
|
||||
required: true
|
||||
tags:
|
||||
description: "image tags / buildctl image name"
|
||||
required: true
|
||||
context:
|
||||
description: "buildctl build context"
|
||||
required: false
|
||||
default: "."
|
||||
dockerfile:
|
||||
description: "buildctl build dockerfile/folder"
|
||||
required: true
|
||||
default: "."
|
||||
runs:
|
||||
using: "composite"
|
||||
steps:
|
||||
- name: Authenticate to Gitea registry
|
||||
shell: bash
|
||||
run: |
|
||||
# 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 \
|
||||
--frontend=dockerfile.v0 \
|
||||
--local context=${{ inputs.context }} \
|
||||
--local dockerfile=${{ inputs.dockerfile }} \
|
||||
--opt filename=Dockerfile \
|
||||
--output type=image,name=${{ inputs.tags }},push=true,registry.config=$DOCKER_CONFIG_FILE
|
||||
|
||||
81
.gitea/limbo_actions/buildkit-build-push/action.yaml
Normal file
81
.gitea/limbo_actions/buildkit-build-push/action.yaml
Normal file
@@ -0,0 +1,81 @@
|
||||
name: BuildKit Build and push
|
||||
description: "Build and push images using remote Buildkit"
|
||||
inputs:
|
||||
registry_addr:
|
||||
description: registry address
|
||||
required: true
|
||||
registry_username:
|
||||
description: "registry username"
|
||||
required: true
|
||||
registry_password:
|
||||
description: "registry password"
|
||||
required: true
|
||||
buildkit_addr:
|
||||
description: "buildkit address"
|
||||
required: true
|
||||
tags:
|
||||
description: "image tags / buildctl image name"
|
||||
required: true
|
||||
context:
|
||||
description: "buildctl build context"
|
||||
required: false
|
||||
default: "."
|
||||
dockerfile:
|
||||
description: "buildctl build dockerfile/folder"
|
||||
required: true
|
||||
default: "."
|
||||
filename:
|
||||
description: "Docker file name (Default: Dockerfile)"
|
||||
required: true
|
||||
default: "Dockerfile"
|
||||
build_args:
|
||||
description: "Build arguments (multiline KEY=VALUE)"
|
||||
required: false
|
||||
default: ""
|
||||
runs:
|
||||
using: "composite"
|
||||
steps:
|
||||
- name: run buildctl build and push
|
||||
shell: bash
|
||||
run: |
|
||||
|
||||
# create docker config temp folder
|
||||
DOCKER_CONFIG_DIR="${RUNNER_TEMP}/.buildctl_docker"
|
||||
mkdir -p "$DOCKER_CONFIG_DIR"
|
||||
|
||||
# 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
|
||||
{
|
||||
"auths": {
|
||||
"${{ inputs.registry_addr }}": {
|
||||
"auth": "$AUTH"
|
||||
}
|
||||
}
|
||||
}
|
||||
EOF
|
||||
|
||||
# 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 \
|
||||
--frontend=dockerfile.v0 \
|
||||
--local context=${{ inputs.context }} \
|
||||
--local dockerfile=${{ inputs.dockerfile }} \
|
||||
--opt filename=${{ inputs.filename }} \
|
||||
$BUILD_ARG_FLAGS \
|
||||
--output type=image,name=${{ inputs.tags }},push=true
|
||||
|
||||
|
||||
@@ -7,25 +7,20 @@ on:
|
||||
|
||||
jobs:
|
||||
build-docker-image:
|
||||
runs-on: ubuntu-latest
|
||||
runs-on: ["oci-image-builder", "amd64"]
|
||||
|
||||
steps:
|
||||
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v2
|
||||
|
||||
- name: Log in to git.limbosolutions.com docker registry
|
||||
uses: docker/login-action@v3
|
||||
with:
|
||||
registry: git.limbosolutions.com
|
||||
username: ${{ secrets.GITLIMBO_DOCKER_REGISTRY_USERNAME }}
|
||||
password: ${{ secrets.GITLIMBO_DOCKER_REGISTRY_PASSWORD }}
|
||||
|
||||
- name: Build and push Docker Image
|
||||
id: push
|
||||
uses: docker/build-push-action@v6
|
||||
uses: ./.gitea/limbo_actions/buildkit-build-push
|
||||
with:
|
||||
registry_addr: ${{ vars.GITLIMBO_DOCKER_REGISTRY_ADDRESS }}
|
||||
registry_username: ${{ secrets.GITLIMBO_DOCKER_REGISTRY_USERNAME }}
|
||||
registry_password: ${{ secrets.GITLIMBO_DOCKER_REGISTRY_PASSWORD }}
|
||||
buildkit_addr: ${{ vars.BUILDKIT_ADDRESS }}
|
||||
context: ${{gitea.workspace}}/acts/network-stack
|
||||
file: ${{gitea.workspace}}/acts/network-stack/Dockerfile
|
||||
push: true
|
||||
tags: git.limbosolutions.com/kb/gitea/act:latest-network-stack
|
||||
dockerfile: ${{gitea.workspace}}/acts/network-stack
|
||||
tags: git.limbosolutions.com/kb/gitea/act:latest-network-stack
|
||||
|
||||
@@ -7,25 +7,22 @@ on:
|
||||
|
||||
jobs:
|
||||
build-docker-image:
|
||||
runs-on: ubuntu-latest
|
||||
runs-on: ["oci-image-builder", "amd64"]
|
||||
|
||||
steps:
|
||||
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v2
|
||||
|
||||
- name: Log in to git.limbosolutions.com docker registry
|
||||
uses: docker/login-action@v3
|
||||
with:
|
||||
registry: git.limbosolutions.com
|
||||
username: ${{ secrets.GITLIMBO_DOCKER_REGISTRY_USERNAME }}
|
||||
password: ${{ secrets.GITLIMBO_DOCKER_REGISTRY_PASSWORD }}
|
||||
|
||||
- name: Build and push Docker Image
|
||||
id: push
|
||||
uses: docker/build-push-action@v6
|
||||
uses: ./.gitea/limbo_actions/buildkit-build-push
|
||||
with:
|
||||
registry_addr: ${{ vars.GITLIMBO_DOCKER_REGISTRY_ADDRESS }}
|
||||
registry_username: ${{ secrets.GITLIMBO_DOCKER_REGISTRY_USERNAME }}
|
||||
registry_password: ${{ secrets.GITLIMBO_DOCKER_REGISTRY_PASSWORD }}
|
||||
buildkit_addr: ${{ vars.BUILDKIT_ADDRESS }}
|
||||
context: ${{gitea.workspace}}/act-runners/network-stack
|
||||
file: ${{gitea.workspace}}/act-runners/network-stack/Dockerfile
|
||||
push: true
|
||||
tags: git.limbosolutions.com/kb/gitea/act_runner:0.2.13-network-stack
|
||||
dockerfile: ${{gitea.workspace}}/act-runners/network-stack
|
||||
tags: git.limbosolutions.com/kb/gitea/act_runner:0.3-network-stack
|
||||
|
||||
|
||||
|
||||
@@ -23,6 +23,6 @@ mkdir -p ${RUNNER_TEMP}/gitea_src
|
||||
mkdir -p ${WORKSPACE}/.gitea/limbo_actions
|
||||
git clone -b main --depth=1 https://git.limbosolutions.com/kb/gitea ${RUNNER_TEMP}/gitea_src
|
||||
|
||||
for dir in ${RUNNER_TEMP}/gitea_src/.gitea/actions/*; do
|
||||
for dir in ${RUNNER_TEMP}/gitea_src/.gitea/limbo_actions/*; do
|
||||
ln -s "$dir" "${WORKSPACE}/.gitea/limbo_actions/$(basename "$dir")"
|
||||
done
|
||||
Reference in New Issue
Block a user