From 7e6a90d2edea1d8a74f9480f48af103486c91b0b Mon Sep 17 00:00:00 2001 From: Taikun Corner Date: Tue, 5 Aug 2025 11:54:44 +0200 Subject: [PATCH] feat: add container build --- .dockerignore | 6 ++++++ .github/workflows/docker.yml | 29 +++++++++++++++++++++++++++++ Dockerfile | 12 ++++++++++++ README.md | 15 +++++++++++++++ 4 files changed, 62 insertions(+) create mode 100644 .dockerignore create mode 100644 .github/workflows/docker.yml create mode 100644 Dockerfile diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..e2c3dbc --- /dev/null +++ b/.dockerignore @@ -0,0 +1,6 @@ +.git +.github +bin/compile.sh +bin/cross-compile.sh +bin/README.md +bin/example.json diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml new file mode 100644 index 0000000..823c4ae --- /dev/null +++ b/.github/workflows/docker.yml @@ -0,0 +1,29 @@ +name: Container 📦 + +on: + push: + branches: [master] + pull_request: + +permissions: + contents: read + packages: write + +jobs: + build: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: docker/setup-qemu-action@v3 + - uses: docker/setup-buildx-action@v3 + - uses: docker/login-action@v3 + with: + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + - uses: docker/build-push-action@v5 + with: + context: . + push: ${{ github.event_name == 'push' && github.ref == 'refs/heads/master' }} + platforms: linux/amd64,linux/386,linux/arm64,linux/arm/v7 + tags: ghcr.io/${{ github.repository }}:latest diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..c774788 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,12 @@ +FROM debian:stable-slim + +RUN apt-get update && apt-get install -y --no-install-recommends \ + ca-certificates curl wget iputils-ping && \ + rm -rf /var/lib/apt/lists/* + +WORKDIR /opt/yabs +COPY bin ./bin +COPY yabs.sh . +RUN chmod +x yabs.sh + +ENTRYPOINT ["./yabs.sh"] diff --git a/README.md b/README.md index 251307b..ccdfd2f 100644 --- a/README.md +++ b/README.md @@ -32,6 +32,21 @@ wget -qO- yabs.sh | bash **Windows Users**: This script can be run on Windows systems by using [Windows Subsystem for Linux v2 (WSL 2)](https://learn.microsoft.com/en-us/windows/wsl/about). WSLv1 will not run the script and binaries correctly. +### Docker + +A container image is available from the GitHub Container Registry: + +```sh +docker run --rm ghcr.io/masonr/yet-another-bench-script +``` + +Additional flags can be passed after the image name, for example: + +```sh +docker run --rm ghcr.io/masonr/yet-another-bench-script -f -i +``` + + ### Flags (Skipping Tests, Reducing iperf Locations, Geekbench 4/5/6, etc.) ```