Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
81 changes: 40 additions & 41 deletions .github/workflows/docker-build-push.yml
Original file line number Diff line number Diff line change
@@ -1,26 +1,18 @@
name: Docker build and push

on:
push:
tags:
- "v*"
branches:
- "master"
- "release/*"
pull_request:
branches:
- "master"

jobs:
cache:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Cache Docker layers
uses: actions/cache@v2
with:
path: /tmp/.buildx-cache
key: ${{ runner.os }}-docker-${{ hashFiles('**/Dockerfile') }}

docker:
needs: cache
runs-on: ubuntu-latest
environment: ci
permissions:
Expand All @@ -31,13 +23,34 @@ jobs:
- name: Checkout repository
uses: actions/checkout@v4

- name: Docker metadata setup
id: meta
uses: docker/metadata-action@v4
with:
images: |
ghcr.io/donkeyx/cluster-utils
docker.io/donkeyx/cluster-utils
tags: |
type=sha
type=ref,event=branch
type=semver,pattern={{version}}
type=semver,pattern={{major}}
type=semver,pattern={{major}}.{{minor}}
type=raw,value=latest,enable={{is_default_branch}}

- name: Set up QEMU
uses: docker/setup-qemu-action@v3

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
# with:
# driver-opts: |
# image=moby/buildkit:v0.15.0
# buildkitd-flags: --debug


- name: Login to Docker Hub
if: github.event_name != 'pull_request' && vars.DOCKERHUB_USERNAME != ''
uses: docker/login-action@v3
with:
username: ${{ vars.DOCKERHUB_USERNAME }}
Expand All @@ -50,38 +63,24 @@ jobs:
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Docker meta (GHCR)
id: meta
uses: docker/metadata-action@v4
with:
images: |
ghcr.io/donkeyx/cluster-utils
docker.io/donkeyx/cluster-utils
tags: |
type=sha
type=ref,event=branch
type=semver,pattern={{version}}
type=semver,pattern={{major}}
type=semver,pattern={{major}}.{{minor}}
branches: |
release/*

- name: Debug Metadata Outputs
run: |
echo "Tags: ${{ steps.meta.outputs.tags }}"
echo "Labels: ${{ steps.meta.outputs.labels }}"
echo "Images: ${{ steps.meta.outputs.images }}"
echo "Meta Outputs: ${{ toJson(steps.meta.outputs) }}"


- name: Build and push
uses: docker/build-push-action@v5
uses: docker/build-push-action@v6
with:
context: .
platforms: linux/amd64,linux/arm64
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.meta.outputs.tags }}
build-args: VERSION=${{ env.VERSION }}
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=local,src=/tmp/.buildx-cache
cache-to: type=local,dest=/tmp/.buildx-cache
cache-from: type=gha
cache-to: type=gha,mode=max
provenance: false
sbom: false

- name: Update DockerHub README
if: github.event_name != 'pull_request' && vars.DOCKERHUB_USERNAME != ''
uses: peter-evans/dockerhub-description@v4
with:
username: ${{ vars.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
repository: donkeyx/cluster-utils
readme-filepath: ./README.md
16 changes: 7 additions & 9 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -1,12 +1,6 @@
name: Release

on:
workflow_run:
workflows: ["Docker build and push"]
tags: [ 'v*.*.*' ]
types:
- completed

push:
tags: [ 'v*.*.*' ]

Expand All @@ -28,11 +22,15 @@ jobs:

steps:
- name: Checkout repository
uses: actions/checkout@v3
uses: actions/checkout@v4

# ################################
# create release and push assets
# ################################
# create release and push assets
# ################################
- name: Verify Docker build
if: startsWith(github.ref, 'refs/tags/')
run: |
docker build -t cluster-utils:release-test .

- name: Release to github with Notes
uses: softprops/action-gh-release@v1
Expand Down
19 changes: 19 additions & 0 deletions Changelog.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# Changelog

## [3.0.0] - 2025-10-08
### Added
- 🐴 ASCII donkey mascot with colorized welcome message
- Auto-updating k6 load testing tool (fetches latest version)
- Zsh as default shell with Oh My Zsh configuration
- Multi-shell auto-switching capability

### Changed
- **BREAKING**: Converted from Job to Deployment for continuous operation
- Replaced vegeta with k6 for modern load testing
- Optimized Docker layers for smaller image size (~220MB)
- Enhanced README with comprehensive usage examples

### Removed
- All timeout configurations (RUNTIME env, ttlSecondsAfterFinished)
- MongoDB tools (reduced bloat)
- Separate kickstart.sh script (consolidated into Dockerfile)
77 changes: 52 additions & 25 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,31 +1,58 @@
FROM debian:bookworm-slim

# Metadata
ARG VERSION=latest
LABEL maintainer="David Binney <donkeysoft@gmail.com>"
LABEL version=$VERSION
LABEL description="This is a utility for testing within cluster or networks and not needing to install tooling"
FROM alpine:latest

ENV TZ="Australia/Adelaide"

WORKDIR /app

COPY ./*.sh /app/

# Update and install all required tools in one RUN command to minimize layers
RUN apt-get update && apt-get install -y --no-install-recommends \
dnsutils netcat-openbsd curl wget tar gnupg vim tmux zsh \
postgresql-client redis-tools git golang nodejs npm && \
apt-get clean && \
rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*

# Uncomment and modify the MongoDB tools installation if needed
# RUN curl -fsSL https://www.mongodb.org/static/pgp/server-7.0.asc | gpg --dearmor -o /usr/share/keyrings/mongodb-server-7.0.gpg && \
# echo "deb [signed-by=/usr/share/keyrings/mongodb-server-7.0.gpg] http://repo.mongodb.org/apt/debian bookworm/mongodb-org/7.0 main" | tee /etc/apt/sources.list.d/mongodb-org-7.0.list && \
# apt-get update && apt-get install -y --no-install-recommends mongodb-org-tools && \
# apt-get clean && \
# rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*

RUN ./kickstart.sh
# Copy scripts
COPY sleeper.sh /app/runner.sh
COPY welcome.sh /app/welcome.sh

# Install packages, setup tools, and cleanup in a single layer
RUN set -eux && \
# Install system packages
apk add --no-cache \
bind-tools \
netcat-openbsd \
curl \
wget \
git \
jq \
vim \
tmux \
zsh \
postgresql-client \
redis \
npm \
tar && \
# Install oh-my-zsh
sh -c "$(wget -O- https://raw.githubusercontent.com/robbyrussell/oh-my-zsh/master/tools/install.sh)" && \
# Install k6 (lighter than vegeta) - always get the latest version
K6_VERSION=$(curl -s https://api.github.com/repos/grafana/k6/releases/latest | jq -r '.tag_name') && \
curl -sS -L https://github.com/grafana/k6/releases/download/${K6_VERSION}/k6-${K6_VERSION}-linux-amd64.tar.gz | tar -xz --strip-components=1 && \
mv k6 /usr/local/bin/ && \
# Make scripts executable and configure welcome message
chmod +x /app/runner.sh /app/welcome.sh && \
echo "# Show welcome message on interactive shell login" >> /root/.zshrc && \
echo "if [[ \$- == *i* ]] && [[ -z \$WELCOME_SHOWN ]]; then" >> /root/.zshrc && \
echo " export WELCOME_SHOWN=1" >> /root/.zshrc && \
echo " /app/welcome.sh" >> /root/.zshrc && \
echo "fi" >> /root/.zshrc && \
# Set zsh as the default shell for root user in multiple ways for compatibility
sed -i 's|root:.*:/bin/.*sh|root:x:0:0:root:/root:/bin/zsh|g' /etc/passwd && \
# Also set SHELL environment variable as fallback
echo 'export SHELL=/bin/zsh' >> /root/.profile && \
echo 'export SHELL=/bin/zsh' >> /root/.zshrc && \
# Create a .profile that auto-switches to zsh if we're in an interactive session with sh/ash
echo '# Auto-switch to zsh if in interactive mode and not already in zsh' >> /root/.profile && \
echo 'if [ -t 0 ] && [ "$0" != "/bin/zsh" ] && [ "$0" != "zsh" ] && [ -z "$ZSH_SWITCHED" ]; then' >> /root/.profile && \
echo ' export ZSH_SWITCHED=1' >> /root/.profile && \
echo ' exec /bin/zsh' >> /root/.profile && \
echo 'fi' >> /root/.profile && \
# Make sure .profile is sourced by ash/sh
ln -sf /root/.profile /root/.ashrc && \
# Cleanup to reduce image size
rm -rf /var/cache/apk/* /tmp/* /root/.oh-my-zsh/.git

ENTRYPOINT ["sh", "/app/runner.sh"]

ENTRYPOINT ["zsh", "/app/sleeper.sh"]
Loading