Skip to content

Commit

Permalink
Merge pull request #580 from sstidl/switch-docker-repo
Browse files Browse the repository at this point in the history
Switch docker repo from docker-hub to github packages
  • Loading branch information
sstidl authored Nov 4, 2023
2 parents 06803a8 + b1aa632 commit 32f6e65
Show file tree
Hide file tree
Showing 3 changed files with 91 additions and 11 deletions.
80 changes: 80 additions & 0 deletions .github/workflows/docker-publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
name: Docker

# This workflow uses actions that are not certified by GitHub.
# They are provided by a third-party and are governed by
# separate terms of service, privacy policy, and support
# documentation.

on:
# schedule:
# - cron: '30 20 * * *'
push:
branches: ["*"]
# Publish semver tags as releases.
tags: ["v*.*.*"]
pull_request:
branches: ["{{is_default_branch}}"]

env:
# Use docker.io for Docker Hub if empty
REGISTRY: ghcr.io
# github.repository as <account>/<repo>
IMAGE_NAME: ${{ github.repository }}

jobs:
build:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
# This is used to complete the identity challenge
# with sigstore/fulcio when running outside of PRs.
id-token: write

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

# Set up BuildKit Docker container builder to be able to build
# multi-platform images and export cache
# https://github.com/docker/setup-buildx-action
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@f95db51fddba0c2d1ec667646a06c2ce06100226 # v3.0.0

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

# Extract metadata (tags, labels) for Docker
# https://github.com/docker/metadata-action
- name: Extract Docker metadata
id: meta
uses: docker/metadata-action@96383f45573cb7f253c731d3b3ab81c87ef81934 # v5.0.0
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
tags: |
type=ref,event=branch
type=ref,event=pr
# set latest tag for default branch
type=raw,value=latest,enable={{is_default_branch}}
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
# 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
id: build-and-push
uses: docker/build-push-action@0565240e2d4ab88bba5387d719585280857ece09 # v5.0.0
with:
context: .
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=gha
cache-to: type=gha,mode=max
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ There is a more in-depth installation video here:
A template to build an Android client for your LibreSpeed installation is available [here](https://github.com/librespeed/speedtest-android).

## Docker
A docker image is available on the [Docker Hub](https://registry.hub.docker.com/r/adolfintel/speedtest), check our [docker documentation](doc_docker.md) for more info about it
A docker image is available on [GitHub](https://github.com/librespeed/speedtest/pkgs/container/speedtest), check our [docker documentation](doc_docker.md) for more info about it.

## Go backend
A Go implementation is available in the [`speedtest-go`](https://github.com/librespeed/speedtest-go) repo, maintained by [Maddie Zhan](https://github.com/maddie).
Expand Down
20 changes: 10 additions & 10 deletions doc_docker.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
A docker version of LibreSpeed is available on docker hub: [https://hub.docker.com/r/adolfintel/speedtest/](https://hub.docker.com/r/adolfintel/speedtest/)
A docker version of LibreSpeed is available here: [GitHub Packages](https://github.com/librespeed/speedtest/pkgs/container/speedtest)

## Downloading from Docker hub
To download LibreSpeed from the docker hub, use this command:
## Downloading docker image
To download LibreSpeed from the docker repo, use this command:

```
docker pull adolfintel/speedtest
docker pull ghcr.io/librespeed/speedtest
```

You will now have a new docker image called `adolfintel/speedtest`.
You will now have a new docker image called `librespeed/speedtest`.


## Docker Compose
Expand All @@ -18,7 +18,7 @@ version: '3.7'
services:
speedtest:
container_name: speedtest
image: adolfintel/speedtest
image: ghcr.io/librespeed/speedtest:latest
restart: always
environment:
MODE: standalone
Expand Down Expand Up @@ -67,13 +67,13 @@ So if you want your data to be persisted over image updates, you have to mount a
This command starts LibreSpeed in standalone mode, with the default settings, on port 80:

```
docker run -e MODE=standalone -p 80:80 -it adolfintel/speedtest
docker run -e MODE=standalone -p 80:80 -it ghcr.io/librespeed/speedtest
```

This command starts LibreSpeed in standalone mode, with telemetry, ID obfuscation and a stats password, on port 86:

```
docker run -e MODE=standalone -e TELEMETRY=true -e ENABLE_ID_OBFUSCATION=true -e PASSWORD="yourPasswordHere" -e WEBPORT=86 -p 86:86 -v $PWD/db-dir/:/database -it adolfintel/speedtest
docker run -e MODE=standalone -e TELEMETRY=true -e ENABLE_ID_OBFUSCATION=true -e PASSWORD="yourPasswordHere" -e WEBPORT=86 -p 86:86 -v $PWD/db-dir/:/database -it ghcr.io/librespeed/speedtest
```

## Multiple Points of Test
Expand All @@ -90,7 +90,7 @@ Here's a list of additional environment variables available in this mode:
###### Example:
This command starts LibreSpeed in backend mode, with the default settings, on port 80:
```
docker run -e MODE=backend -p 80:80 -it adolfintel/speedtest
docker run -e MODE=backend -p 80:80 -it ghcr.io/librespeed/speedtest
```

### Frontend mode
Expand Down Expand Up @@ -137,5 +137,5 @@ Here's a list of additional environment variables available in this mode:
###### Example
This command starts LibreSpeed in frontend mode, with a given `servers.json` file, and with telemetry, ID obfuscation, and a stats password:
```
docker run -e MODE=frontend -e TELEMETRY=true -e ENABLE_ID_OBFUSCATION=true -e PASSWORD="yourPasswordHere" -v $(pwd)/servers.json:/servers.json -p 80:80 -it adolfintel/speedtest
docker run -e MODE=frontend -e TELEMETRY=true -e ENABLE_ID_OBFUSCATION=true -e PASSWORD="yourPasswordHere" -v $(pwd)/servers.json:/servers.json -p 80:80 -it ghcr.io/librespeed/speedtest
```

0 comments on commit 32f6e65

Please sign in to comment.