From 86cf9e5c31d77d0606cfbbd177354571a9580204 Mon Sep 17 00:00:00 2001
From: Chris Coley <chris@codingallnight.com>
Date: Sun, 20 Apr 2025 17:07:50 -0700
Subject: [PATCH] Push images to Docker Hub

---
 .gitlab-ci.yml |  8 ++++++++
 README.md      | 42 +++++++++++++++++++++++++++++++++++++++---
 2 files changed, 47 insertions(+), 3 deletions(-)

diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index d25cd77..ea8c658 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -3,6 +3,9 @@ stages:
   - test
   - release
 
+variables:
+  DOCKER_HUB_REPO: ccoley/iperf
+
 
 
 .build:
@@ -79,6 +82,7 @@ test:iperf3:
     - if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH
   before_script:
     - crane auth login -u "$CI_REGISTRY_USER" -p "$CI_REGISTRY_PASSWORD" "$CI_REGISTRY"
+    - crane auth login -u "$DOCKER_HUB_USERNAME" -p "$DOCKER_HUB_TOKEN" index.docker.io
 
 release:iperf2:
   extends: .release
@@ -86,6 +90,8 @@ release:iperf2:
   script:
     - crane tag ${CI_REGISTRY_IMAGE}:${CI_COMMIT_SHORT_SHA}-iperf2 2.2
     - crane tag ${CI_REGISTRY_IMAGE}:${CI_COMMIT_SHORT_SHA}-iperf2 2
+    - crane copy ${CI_REGISTRY_IMAGE}:${CI_COMMIT_SHORT_SHA}-iperf2 ${DOCKER_HUB_REPO}:2.2
+    - crane tag ${DOCKER_HUB_REPO}:2.2 2
 
 release:iperf3:
   extends: .release
@@ -93,5 +99,7 @@ release:iperf3:
   script:
     - crane tag ${CI_REGISTRY_IMAGE}:${CI_COMMIT_SHORT_SHA}-iperf3 3.17
     - crane tag ${CI_REGISTRY_IMAGE}:${CI_COMMIT_SHORT_SHA}-iperf3 3
+    - crane copy ${CI_REGISTRY_IMAGE}:${CI_COMMIT_SHORT_SHA}-iperf3 ${DOCKER_HUB_REPO}:3.17
+    - crane tag ${DOCKER_HUB_REPO}:3.17 3
 
 # vi: set ts=2 sw=2 et ft=yaml:
diff --git a/README.md b/README.md
index 07e6a27..d5ed2e5 100644
--- a/README.md
+++ b/README.md
@@ -1,8 +1,44 @@
-# iPerf
+# iPerf Image
 
-This is an image for running iPerf. Both iPerf 2 and iPerf 3 are available.
+This repo builds two Docker images meant for use as an iperf server.
 
-iPerf runs in server mode with default port and settings.
+## Tags
+
+There are images available with iPerf 2 or iPerf 3.
+
+- `3.17`, `3` contain iPerf 3
+- `2.2`, `2` contain iPerf 2
+
+## Usage
+
+The images default to running in server mode on the default port, which is 5001 for iPerf 2 and 5201 for iPerf 3.
+
+### Server Mode
+
+Running an iPerf 3 server:
+
+```bash
+docker run --rm -p 5201:5201 ccoley/iperf:3
+```
+
+Running an iPerf 2 server:
+
+```bash
+docker run --rm -p 5001:5001 ccoley/iperf:2
+```
+
+### Client Mode
+
+Running iPerf 3 in client mode:
+
+```bash
+docker run --rm -t ccoley/iperf:3 -c <iperf3-server>
+```
+
+Running iPerf 2 in client mode:
+```bash
+docker run --rm -t ccoley/iperf:2 -c <iperf2-server> -i 1
+```
 
 
 
-- 
GitLab