webgrind icon indicating copy to clipboard operation
webgrind copied to clipboard

Docker image still on 1.8

Open jorrit opened this issue 3 years ago • 11 comments

First of all, thanks for this great tool!

One of the nicest things is that I can easily run it with Docker, without installing anything. However, the Docker image is still on 1.8. Could it be updated so it uses 1.9? Thanks!

jorrit avatar Jan 27 '22 14:01 jorrit

Hmm thought it was supposed to auto update. I do not have write access to Docker; @jokkedk could you take a look into it?

alpha0010 avatar Jan 28 '22 13:01 alpha0010

This is probably due to the fact that DockerHub removed free automated builds for open source projects (due to cryptominer abuse) in June 2021. This blog post has more details: https://www.docker.com/blog/changes-to-docker-hub-autobuilds/.

It's very easy to use GitHub Actions to update DockerHub images (see, e.g., https://github.com/smrealms/smr/commit/25776ee421f20f7588148c8a5cb9d7ee64b005bd), but you do need to store the DockerHub credentials as repository secrets. I'm happy to help with a PR, but we probably still need @jokkedk's attention on this either way.

hemberger avatar Mar 07 '22 05:03 hemberger

I'm totally ignorant when it comes to Docker images, but is there any way to force 1.9 via docker-compose?

johncarter- avatar May 04 '22 09:05 johncarter-

Apologies for much lag. I am not sure what I ned to do to get Docker to update. Any pointers appreciated.

jokkedk avatar May 04 '22 12:05 jokkedk

No stress.

As @hemberger says, it looks like the docker image has to use GitHub Actions to be created. You need access to create GitHub repo secrets for use in the action.

Approach 2 from this article looks promising: https://davelms.medium.com/build-your-docker-images-automatically-when-pushing-new-code-to-github-394f4c1679cc

johncarter- avatar May 04 '22 13:05 johncarter-

@jokkedk I'd be happy to help out however I can. If you go to Settings ➔ Secrets ➔ Actions, you can add your Dockerhub credentials to the "Repository secrets" as, e.g., DOCKERHUB_TOKEN and DOCKERHUB_USERNAME.

Then you can add a GitHub Action to push to DockerHub on release by creating a file, e.g. .github/workflows/build-release.yml. The simplest example would be:

name: Build Release

on:
  release:
    types: [published]

jobs:
  build-release:
    runs-on: ubuntu-20.04
    steps:
      - name: Set up Docker Buildx
        uses: docker/setup-buildx-action@v1

      - name: Login to DockerHub
        uses: docker/login-action@v1
        with:
          username: ${{ secrets.DOCKERHUB_USERNAME }}
          password: ${{ secrets.DOCKERHUB_TOKEN }}

      - name: Build and push image 
        uses: docker/build-push-action@v2
        with:
          push: true
          tags: jokkedk/webgrind:latest

If it would help, I can submit this as a PR, but we would probably need some back-and-forth to get this all configured properly to your liking.

hemberger avatar May 04 '22 16:05 hemberger

I just forked this repo and created a DockerHub repo and can confirm that I have 1.9 working on my fork using @hemberger 's instructions ~( there is a typo present in the above .yaml)~.

Full Instructions:

  1. Log into DockerHub
  2. In your user account menu (top right avatar) go to Account Settings
  3. Go to Security > Add New Access Token call it "GitHub Actions" or whatever
  4. Make a note of your access token
  5. Go to this repo's Github Secrets
  6. Add two new secrets: DOCKERHUB_USERNAME and DOCKERHUB_TOKEN (the access token recently copied from DockerHub)
  7. Create the file .github/workflows/build-release.yml
name: Build Release

on:
  release:
    types: [published]

jobs:
  build-release:
    runs-on: ubuntu-20.04
    steps:
      - name: Set up Docker Buildx
        uses: docker/setup-buildx-action@v1

      - name: Login to DockerHub
        uses: docker/login-action@v1
        with:
          username: ${{ secrets.DOCKERHUB_USERNAME }}
          password: ${{ secrets.DOCKERHUB_TOKEN }}

      - name: Build and push image 
        uses: docker/build-push-action@v2
        with:
          push: true
          tags: jokkedk/webgrind:latest
  1. Then tag and publish a new release of this repo, the Docker image action will run and push the image to Docker.
  2. 💷 Profit then 🥳 party.

johncarter- avatar May 09 '22 11:05 johncarter-

( there is a typo present in the above .yaml)

The typo has been fixed, and now our snippets are identical. Thanks for pointing it out (and for the additional testing)!

hemberger avatar May 09 '22 17:05 hemberger

Any progress here?

theloveofcode avatar May 28 '22 01:05 theloveofcode

Thank you for helping! I've set up the action and tagged a new release. Seems to be working 🥳

Ideally the action would mark the docker image with the release tag, e.g. v1.9.1, but at least it is updating now. It should be possible to grab tags with docker/metadata-action.

jokkedk avatar May 31 '22 07:05 jokkedk

Ideally the action would mark the docker image with the release tag, e.g. v1.9.1, but at least it is updating now. It should be possible to grab tags with docker/metadata-action.

I've submitted a PR that should do this, I don't have a great way to test it though.

Cleptomania avatar Jun 01 '22 15:06 Cleptomania

I believe this was fixed

jokkedk avatar Oct 04 '23 06:10 jokkedk