adding build images
All checks were successful
Test Actions (self-test) / Test Kubernetes actions (push) Successful in 8s
Test Actions (self-test) / Build tiny multi-arch image (push) Successful in 9s
Test Actions (self-test) / Test SSH deploy action (push) Successful in 15s
Build and Push Runner Images / Build Slim Runner Image (push) Successful in 1m24s
Build and Push Runner Images / Build Full Runner Image (push) Successful in 3m51s

This commit is contained in:
2026-07-13 21:11:42 -03:00
parent de1ecdf5bd
commit ef3dd4f81c
5 changed files with 219 additions and 6 deletions

View File

@@ -0,0 +1,49 @@
name: Build and Push Runner Images
on:
push:
branches:
- main
paths:
- 'images/**'
- '.gitea/workflows/build-images.yaml'
workflow_dispatch: {}
env:
SLIM_IMAGE: git.ivanch.me/ivanch/runner-images
FULL_IMAGE: git.ivanch.me/ivanch/runner-images
jobs:
build-slim:
name: Build Slim Runner Image
runs-on: ubuntu-amd64
steps:
- name: Check out repository
uses: actions/checkout@v4
- name: Build and push slim image
uses: https://git.ivanch.me/ivanch/pipeline-actions/build-and-push@main
with:
image: ${{ env.SLIM_IMAGE }}
image_tag: slim
build_context: images/slim
build_dockerfile: Dockerfile
registry_password: ${{ secrets.REGISTRY_PASSWORD }}
ssh_key: ${{ secrets.SSH_KEY_DOCKERBUILD }}
build-full:
name: Build Full Runner Image
runs-on: ubuntu-amd64
steps:
- name: Check out repository
uses: actions/checkout@v4
- name: Build and push full image
uses: https://git.ivanch.me/ivanch/pipeline-actions/build-and-push@main
with:
image: ${{ env.FULL_IMAGE }}
image_tag: full
build_context: images/full
build_dockerfile: Dockerfile
registry_password: ${{ secrets.REGISTRY_PASSWORD }}
ssh_key: ${{ secrets.SSH_KEY_DOCKERBUILD }}

View File

@@ -38,15 +38,66 @@ runs:
env: env:
KUBE_VERSION: ${{ inputs.kube_version }} KUBE_VERSION: ${{ inputs.kube_version }}
run: | run: |
apt-get update -y # strip stray CR (CRLF checkout via core.autocrlf)
apt-get install -y curl KUBE_VERSION=$(printf '%s' "${KUBE_VERSION}" | tr -d '\r')
# 1. Check if kubectl is already pre-installed and meets version requirements
if command -v kubectl &> /dev/null; then
INSTALLED_VER=$(kubectl version --client --output=json 2>/dev/null | grep -oE '"gitVersion": "[^"]+"' | cut -d'"' -f4)
if [ -z "${INSTALLED_VER}" ]; then
INSTALLED_VER=$(kubectl version --client 2>/dev/null | grep -oE 'v[0-9]+\.[0-9]+\.[0-9]+')
fi
echo "Found pre-installed kubectl version: ${INSTALLED_VER}"
# If stable or version matches, reuse pre-installed kubectl
if [ "${KUBE_VERSION}" = "stable" ] || [ "${INSTALLED_VER}" = "${KUBE_VERSION}" ]; then
echo "Using pre-installed kubectl."
exit 0
fi
fi
# 2. Check/install curl if missing
if ! command -v curl &> /dev/null; then
echo "curl not found, attempting to install..."
if command -v apt-get &> /dev/null; then
apt-get update -y && apt-get install -y curl
elif command -v apk &> /dev/null; then
apk add --no-cache curl
elif command -v dnf &> /dev/null; then
dnf install -y curl
elif command -v yum &> /dev/null; then
yum install -y curl
else
echo "::error::curl is missing and no supported package manager (apt-get, apk, dnf, yum) was found."
exit 1
fi
fi
# 3. Resolve version
if [ "${KUBE_VERSION}" = "stable" ]; then if [ "${KUBE_VERSION}" = "stable" ]; then
KUBE_VER="$(curl -L -s https://dl.k8s.io/release/stable.txt)" KUBE_VER="$(curl -L -s https://dl.k8s.io/release/stable.txt)"
else else
KUBE_VER="${KUBE_VERSION}" KUBE_VER="${KUBE_VERSION}"
fi fi
# 4. Download kubectl
echo "Downloading kubectl version ${KUBE_VER}..."
curl -LO "https://dl.k8s.io/release/${KUBE_VER}/bin/linux/amd64/kubectl" curl -LO "https://dl.k8s.io/release/${KUBE_VER}/bin/linux/amd64/kubectl"
# 5. Install kubectl to a writable directory
if [ -w "/usr/local/bin" ]; then
install -m 0755 kubectl /usr/local/bin/kubectl install -m 0755 kubectl /usr/local/bin/kubectl
echo "Installed kubectl to /usr/local/bin"
else
echo "/usr/local/bin is not writable. Installing locally and updating PATH..."
LOCAL_BIN="${HOME}/.local/bin"
mkdir -p "${LOCAL_BIN}"
install -m 0755 kubectl "${LOCAL_BIN}/kubectl"
echo "${LOCAL_BIN}" >> "$GITHUB_PATH"
export PATH="${LOCAL_BIN}:${PATH}"
echo "Installed kubectl to ${LOCAL_BIN}"
fi
kubectl version --client kubectl version --client
- name: Set up kubeconfig - name: Set up kubeconfig

40
images/full/Dockerfile Normal file
View File

@@ -0,0 +1,40 @@
FROM ubuntu:24.04
ENV DEBIAN_FRONTEND=noninteractive
ARG TARGETARCH
# Install base tools, Docker, and utilities
RUN apt-get update && apt-get install -y \
bash \
curl \
wget \
git \
openssh-client \
ca-certificates \
tar \
gzip \
unzip \
zip \
jq \
rsync \
gettext-base \
make \
build-essential \
docker.io \
docker-buildx \
docker-compose-v2 \
&& rm -rf /var/lib/apt/lists/*
# Download and install kubectl matching the target architecture
RUN KUBE_VER=$(curl -L -s https://dl.k8s.io/release/stable.txt) && \
curl -LO "https://dl.k8s.io/release/${KUBE_VER}/bin/linux/${TARGETARCH}/kubectl" && \
install -m 0755 kubectl /usr/local/bin/kubectl && \
rm kubectl
# Install yq (Go-based binary)
RUN YQ_VER="v4.44.1" && \
curl -Lo /usr/local/bin/yq "https://github.com/mikefarah/yq/releases/download/${YQ_VER}/yq_linux_${TARGETARCH}" && \
chmod +x /usr/local/bin/yq
CMD ["/bin/bash"]

22
images/slim/Dockerfile Normal file
View File

@@ -0,0 +1,22 @@
FROM alpine:3.20
ARG TARGETARCH
# Install required packages
RUN apk add --no-cache \
bash \
curl \
wget \
git \
openssh-client \
ca-certificates \
tar \
gzip
# Download and install kubectl matching the target architecture
RUN KUBE_VER=$(curl -L -s https://dl.k8s.io/release/stable.txt) && \
curl -LO "https://dl.k8s.io/release/${KUBE_VER}/bin/linux/${TARGETARCH}/kubectl" && \
install -m 0755 kubectl /usr/local/bin/kubectl && \
rm kubectl
CMD ["/bin/bash"]

View File

@@ -47,15 +47,66 @@ runs:
env: env:
KUBE_VERSION: ${{ inputs.kube_version }} KUBE_VERSION: ${{ inputs.kube_version }}
run: | run: |
apt-get update -y # strip stray CR (CRLF checkout via core.autocrlf)
apt-get install -y curl KUBE_VERSION=$(printf '%s' "${KUBE_VERSION}" | tr -d '\r')
# 1. Check if kubectl is already pre-installed and meets version requirements
if command -v kubectl &> /dev/null; then
INSTALLED_VER=$(kubectl version --client --output=json 2>/dev/null | grep -oE '"gitVersion": "[^"]+"' | cut -d'"' -f4)
if [ -z "${INSTALLED_VER}" ]; then
INSTALLED_VER=$(kubectl version --client 2>/dev/null | grep -oE 'v[0-9]+\.[0-9]+\.[0-9]+')
fi
echo "Found pre-installed kubectl version: ${INSTALLED_VER}"
# If stable or version matches, reuse pre-installed kubectl
if [ "${KUBE_VERSION}" = "stable" ] || [ "${INSTALLED_VER}" = "${KUBE_VERSION}" ]; then
echo "Using pre-installed kubectl."
exit 0
fi
fi
# 2. Check/install curl if missing
if ! command -v curl &> /dev/null; then
echo "curl not found, attempting to install..."
if command -v apt-get &> /dev/null; then
apt-get update -y && apt-get install -y curl
elif command -v apk &> /dev/null; then
apk add --no-cache curl
elif command -v dnf &> /dev/null; then
dnf install -y curl
elif command -v yum &> /dev/null; then
yum install -y curl
else
echo "::error::curl is missing and no supported package manager (apt-get, apk, dnf, yum) was found."
exit 1
fi
fi
# 3. Resolve version
if [ "${KUBE_VERSION}" = "stable" ]; then if [ "${KUBE_VERSION}" = "stable" ]; then
KUBE_VER="$(curl -L -s https://dl.k8s.io/release/stable.txt)" KUBE_VER="$(curl -L -s https://dl.k8s.io/release/stable.txt)"
else else
KUBE_VER="${KUBE_VERSION}" KUBE_VER="${KUBE_VERSION}"
fi fi
# 4. Download kubectl
echo "Downloading kubectl version ${KUBE_VER}..."
curl -LO "https://dl.k8s.io/release/${KUBE_VER}/bin/linux/amd64/kubectl" curl -LO "https://dl.k8s.io/release/${KUBE_VER}/bin/linux/amd64/kubectl"
# 5. Install kubectl to a writable directory
if [ -w "/usr/local/bin" ]; then
install -m 0755 kubectl /usr/local/bin/kubectl install -m 0755 kubectl /usr/local/bin/kubectl
echo "Installed kubectl to /usr/local/bin"
else
echo "/usr/local/bin is not writable. Installing locally and updating PATH..."
LOCAL_BIN="${HOME}/.local/bin"
mkdir -p "${LOCAL_BIN}"
install -m 0755 kubectl "${LOCAL_BIN}/kubectl"
echo "${LOCAL_BIN}" >> "$GITHUB_PATH"
export PATH="${LOCAL_BIN}:${PATH}"
echo "Installed kubectl to ${LOCAL_BIN}"
fi
kubectl version --client kubectl version --client
- name: Set up kubeconfig - name: Set up kubeconfig