@@ -0,0 +1,87 @@
|
||||
name: BuildKit Build and push - dev
|
||||
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 for this pipeline
|
||||
###############################################
|
||||
|
||||
DOCKER_CONFIG_DIR="${RUNNER_TEMP}/.buildctl_docker"
|
||||
mkdir -p "$DOCKER_CONFIG_DIR"
|
||||
|
||||
trap 'rm -rf "$DOCKER_CONFIG_DIR"' EXIT
|
||||
|
||||
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"
|
||||
}
|
||||
}
|
||||
}
|
||||
EOF
|
||||
|
||||
###############################################
|
||||
# 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"
|
||||
|
||||
###############################################
|
||||
# Build + push using BuildKit REMOTE + SECRET
|
||||
###############################################
|
||||
|
||||
buildctl \
|
||||
--addr tcp://${{ 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
|
||||
@@ -24,12 +24,12 @@ jobs:
|
||||
curl -fsSL https://git.limbosolutions.com/kb/gitea/raw/branch/main/cloud-scripts/setup-limbo-actions.sh | bash 2>&1
|
||||
|
||||
- name: Build and push ssh-client container images
|
||||
uses: ./.gitea/limbo_actions/buildkit-build-push
|
||||
uses: ./.gitea/actions/buildkit-build-push-dev
|
||||
with:
|
||||
tags: git.limbosolutions.com/kb/ssh-client
|
||||
registry_addr: ${{ vars.GITLIMBO_DOCKER_REGISTRY_ADDRESS }}
|
||||
registry_username: ${{ secrets.GITLIMBO_DOCKER_REGISTRY_USERNAME }}
|
||||
registry_password: ${{ secrets.GITLIMBO_DOCKER_REGISTRY_PASSWORD }}
|
||||
registry_addr: ${{ vars.OCI_LIMBO_REGISTRY_ADDRESS }}
|
||||
registry_username: ${{ secrets.OCI_LIMBO_REGISTRY_USERNAME }}
|
||||
registry_password: ${{ secrets.OCI_LIMBO_REGISTRY_PASSWORD }}
|
||||
buildkit_addr: ${{ vars.BUILDKIT_ADDRESS }}
|
||||
dockerfile: ${{gitea.workspace}}/docker/ssh-client
|
||||
context: ${{gitea.workspace}}/docker/ssh-client
|
||||
|
||||
@@ -0,0 +1,68 @@
|
||||
FROM ubuntu:22.04
|
||||
|
||||
ENV DEBIAN_FRONTEND=noninteractive
|
||||
|
||||
# ---------------------------------------------------------
|
||||
# Base dependencies
|
||||
# ---------------------------------------------------------
|
||||
RUN apt-get update && apt-get install -y \
|
||||
tini \
|
||||
curl \
|
||||
wget \
|
||||
jq \
|
||||
bash \
|
||||
tar \
|
||||
rsync \
|
||||
rclone \
|
||||
ansible \
|
||||
openssh-client \
|
||||
iptables \
|
||||
uidmap \
|
||||
slirp4netns \
|
||||
fuse-overlayfs \
|
||||
ca-certificates \
|
||||
&& rm -rf /var/lib/apt/lists/*
|
||||
|
||||
# ---------------------------------------------------------
|
||||
# Install ACT Runner
|
||||
# ---------------------------------------------------------
|
||||
RUN curl -L https://dl.gitea.com/act_runner/0.6.0/act_runner-0.6.0-linux-amd64 \
|
||||
-o /usr/local/bin/act_runner && \
|
||||
chmod +x /usr/local/bin/act_runner
|
||||
|
||||
# ---------------------------------------------------------
|
||||
# Install kubectl
|
||||
# ---------------------------------------------------------
|
||||
RUN curl -LO "https://storage.googleapis.com/kubernetes-release/release/$(curl -s https://storage.googleapis.com/kubernetes-release/release/stable.txt)/bin/linux/amd64/kubectl" && \
|
||||
chmod +x kubectl && mv kubectl /usr/local/bin/
|
||||
|
||||
# ---------------------------------------------------------
|
||||
# Install Helm
|
||||
# ---------------------------------------------------------
|
||||
RUN HELM_VERSION=$(curl -s https://api.github.com/repos/helm/helm/releases/latest | jq -r .tag_name) && \
|
||||
curl -fsSL https://get.helm.sh/helm-${HELM_VERSION}-linux-amd64.tar.gz -o helm.tar.gz && \
|
||||
tar -zxvf helm.tar.gz && \
|
||||
mv linux-amd64/helm /usr/local/bin/helm && \
|
||||
rm -rf linux-amd64 helm.tar.gz
|
||||
|
||||
# ---------------------------------------------------------
|
||||
# Install BuildKit (buildkitd + buildctl)
|
||||
# ---------------------------------------------------------
|
||||
ENV BUILDKIT_VERSION=v0.28.0
|
||||
|
||||
RUN curl -L "https://github.com/moby/buildkit/releases/download/${BUILDKIT_VERSION}/buildkit-${BUILDKIT_VERSION}.linux-amd64.tar.gz" \
|
||||
| tar -xz -C /usr/local/bin --strip-components=1
|
||||
|
||||
# ---------------------------------------------------------
|
||||
# Install rootlesskit (required for BuildKit rootless)
|
||||
# ---------------------------------------------------------
|
||||
RUN curl -L https://github.com/rootless-containers/rootlesskit/releases/download/v1.1.1/rootlesskit-x86_64.tar.gz \
|
||||
| tar -xz -C /usr/local/bin
|
||||
|
||||
# ---------------------------------------------------------
|
||||
# Default entrypoint
|
||||
# ---------------------------------------------------------
|
||||
|
||||
WORKDIR /data
|
||||
ENTRYPOINT ["/usr/bin/tini", "--", "/usr/local/bin/act_runner"]
|
||||
CMD ["daemon", "--config", "/etc/act_runner/config.yaml"]
|
||||
Reference in New Issue
Block a user