Compare commits
3 Commits
fefb4b3a17
...
main
| Author | SHA1 | Date | |
|---|---|---|---|
| 950726553c | |||
| 3344c63c2b | |||
| c3a4c39f05 |
57
.gitea/actions/buildkit-build-push/action.yaml
Normal file
57
.gitea/actions/buildkit-build-push/action.yaml
Normal file
@@ -0,0 +1,57 @@
|
|||||||
|
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
|
||||||
|
|
||||||
@@ -44,20 +44,9 @@ RUN HELM_VERSION=$(curl -s https://api.github.com/repos/helm/helm/releases/lates
|
|||||||
rm -rf linux-amd64 helm.tar.gz
|
rm -rf linux-amd64 helm.tar.gz
|
||||||
|
|
||||||
|
|
||||||
### BUILD KID
|
# Install buildctl only (no buildkitd)
|
||||||
|
|
||||||
ENV BUILDKIT_VERSION=v0.28.0
|
ENV BUILDKIT_VERSION=v0.28.0
|
||||||
|
|
||||||
RUN apk add --no-cache \
|
|
||||||
runc \
|
|
||||||
fuse-overlayfs \
|
|
||||||
iptables \
|
|
||||||
shadow \
|
|
||||||
util-linux \
|
|
||||||
containerd
|
|
||||||
|
|
||||||
RUN curl -L "https://github.com/moby/buildkit/releases/download/${BUILDKIT_VERSION}/buildkit-${BUILDKIT_VERSION}.linux-amd64.tar.gz" \
|
RUN curl -L "https://github.com/moby/buildkit/releases/download/${BUILDKIT_VERSION}/buildkit-${BUILDKIT_VERSION}.linux-amd64.tar.gz" \
|
||||||
| tar -xz -C /usr/local \
|
| tar -xz -C /usr/local/bin --strip-components=1 bin/buildctl
|
||||||
&& buildctl --version
|
|
||||||
|
|
||||||
###################
|
###################
|
||||||
Reference in New Issue
Block a user