From 5c7ffb65236a2f19b5f172d65019d98763ee41da Mon Sep 17 00:00:00 2001 From: ipitio <21136719+ipitio@users.noreply.github.com> Date: Fri, 26 Apr 2024 03:38:37 +0000 Subject: [PATCH] publish image on release (#174) * add a Dockerfile, use an action to build and publish it, and update readme to reflect --- .github/workflows/publish.yml | 42 +++++++++++++++++++++++++++++++++++ .gitignore | 2 +- Dockerfile | 2 ++ README.md | 21 +++++++++++++----- 4 files changed, 60 insertions(+), 7 deletions(-) create mode 100644 .github/workflows/publish.yml create mode 100644 Dockerfile diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml new file mode 100644 index 0000000..c2194e5 --- /dev/null +++ b/.github/workflows/publish.yml @@ -0,0 +1,42 @@ +name: Create and publish a Docker image + +on: + release: + types: [published] + +env: + REGISTRY: ghcr.io + IMAGE_NAME: ${{ github.repository }} + +jobs: + build-and-push-image: + runs-on: ubuntu-latest + # Sets the permissions granted to the `GITHUB_TOKEN` for the actions in this job. + permissions: + contents: read + packages: write + + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + - name: Log in to the Container registry + uses: docker/login-action@v3.1.0 + with: + registry: ${{ env.REGISTRY }} + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + + - name: Extract metadata (tags, labels) for Docker + id: meta + uses: docker/metadata-action@v5.5.1 + with: + images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} + + - name: Build and push Docker image + uses: docker/build-push-action@v5.3.0 + with: + context: . + push: true + tags: ${{ steps.meta.outputs.tags }} + labels: ${{ steps.meta.outputs.labels }} diff --git a/.gitignore b/.gitignore index 2c836a4..e18d7e5 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,2 @@ etc* -*\.yml +compose.yml diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..6e40b4f --- /dev/null +++ b/Dockerfile @@ -0,0 +1,2 @@ +FROM pihole/pihole:latest +RUN curl -sSLN https://github.com/arevindh/pi-hole/raw/master/advanced/Scripts/speedtestmod/mod.sh | sudo bash diff --git a/README.md b/README.md index ccecda4..4a17f4f 100644 --- a/README.md +++ b/README.md @@ -35,18 +35,27 @@ Pull requests and suggestions are welcome! Please use our Mod Script to install the latest version of the Mod; it automates the process of swapping Pi-hole's repos to our modded ones and ensures this is done efficiently. To see available options, please look at the [wiki](https://github.com/arevindh/pihole-speedtest/wiki). For information about running Pi-hole in Docker, including a Compose example, please refer to the official [repo](https://github.com/pi-hole/docker-pi-hole/) and [docs](https://docs.pi-hole.net/). -> **Docker Note** -> You'll need to run the script inside every new container if you're not using Compose. - ### Via the Shell -You can just pipe to bash! +You can just pipe to bash: curl -sSLN https://github.com/arevindh/pi-hole/raw/master/advanced/Scripts/speedtestmod/mod.sh | sudo bash -### Docker Compose +### With Docker + +Simply change the image you're using to our modded one: + + ghcr.io/ipitio/pihole-speedtest:latest + +#### Compose + +Choose one of the following options: + +* Change the `image: ...` line to point to our image, +* Replace it with the following and rebuild without cache, or +* Run the Mod Script manually inside every new container. -Replace `image: pihole/pihole:latest` with the following in your `compose.yml`, then rebuild without cache. +The last option is not recommended. build: dockerfile_inline: |