Skip to content

Commit

Permalink
Add speedtest
Browse files Browse the repository at this point in the history
  • Loading branch information
MattKobayashi committed Feb 12, 2024
1 parent fc7e5e4 commit 0685c25
Show file tree
Hide file tree
Showing 2 changed files with 74 additions and 0 deletions.
60 changes: 60 additions & 0 deletions .github/workflows/ghcr-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -617,6 +617,66 @@ jobs:
push: ${{ github.event_name == 'push' || github.event_name == 'schedule' }}
tags: ${{ env.REGISTRY }}/${{ env.REPO_NAME }}/${{ env.IMAGE_NAME }}:latest

build-speedtest:

runs-on: self-hosted
permissions:
contents: read
packages: write

steps:
# Add support for more platforms with QEMU (optional)
# https://github.com/docker/setup-qemu-action
- name: Set up QEMU
uses: docker/setup-qemu-action@v3

# Set up Docker Buildx
# https://github.com/docker/setup-buildx-action
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
with:
config-inline: |
[registry."docker.io"]
mirrors = ["registry-mirror:5000"]
[registry."registry-mirror:5000"]
http = true
driver-opts: |
network=actions-runners
# Gives two environment variables
# One with lowercase repo owner's name
# Another with the name of the image
- name: Set image name
run: |
echo "REPO_NAME=${GITHUB_REPOSITORY_OWNER,,}" >> ${GITHUB_ENV} &&
echo "IMAGE_NAME=${GITHUB_JOB#*-}" >> ${GITHUB_ENV}
# Checkout repository
# https://github.com/actions/checkout
- name: Checkout repository
uses: actions/checkout@v4

# Login against a Docker registry except on PR
# https://github.com/docker/login-action
- name: Log into registry ${{ env.REGISTRY }}
if: |
github.event_name == 'push' ||
github.event_name == 'schedule'
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

# Build and push Docker image with Buildx (don't push on PR)
# https://github.com/docker/build-push-action
- name: Build and push Docker image
uses: docker/build-push-action@v5
with:
context: ./${{ env.IMAGE_NAME }}
push: ${{ github.event_name == 'push' || github.event_name == 'schedule' }}
tags: ${{ env.REGISTRY }}/${{ env.REPO_NAME }}/${{ env.IMAGE_NAME }}:latest

build-stun:

runs-on: self-hosted
Expand Down
14 changes: 14 additions & 0 deletions speedtest/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
FROM alpine:3

# Set work directory
WORKDIR /opt/speedtest/

# Update image and install/extract Ookla Speedtest
RUN apk --no-cache upgrade \
&& wget https://install.speedtest.net/app/cli/ookla-speedtest-1.2.0-linux-x86_64.tgz \
&& tar -xof ookla-speedtest-1.2.0-linux-x86_64.tgz

# Set entrypoint
ENTRYPOINT ["./speedtest", "--accept-license"]

LABEL org.opencontainers.image.authors="MattKobayashi <[email protected]>"

0 comments on commit 0685c25

Please sign in to comment.