Code Monkey home page Code Monkey logo

Comments (12)

hemberger avatar hemberger commented on August 15, 2024 2

@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.

from webgrind.

johncarter- avatar johncarter- commented on August 15, 2024 2

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.

from webgrind.

hemberger avatar hemberger commented on August 15, 2024 1

( 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)!

from webgrind.

jokkedk avatar jokkedk commented on August 15, 2024 1

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.

from webgrind.

alpha0010 avatar alpha0010 commented on August 15, 2024

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

from webgrind.

hemberger avatar hemberger commented on August 15, 2024

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., smrealms/smr@25776ee), 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.

from webgrind.

johncarter- avatar johncarter- commented on August 15, 2024

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

from webgrind.

jokkedk avatar jokkedk commented on August 15, 2024

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

from webgrind.

johncarter- avatar johncarter- commented on August 15, 2024

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

from webgrind.

theloveofcode avatar theloveofcode commented on August 15, 2024

Any progress here?

from webgrind.

Cleptomania avatar Cleptomania commented on August 15, 2024

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.

from webgrind.

jokkedk avatar jokkedk commented on August 15, 2024

I believe this was fixed

from webgrind.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.