Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Publish docker images to github container registry (ghcr.io) #1259

Open
EugenMayer opened this issue Mar 19, 2024 · 4 comments
Open

Publish docker images to github container registry (ghcr.io) #1259

EugenMayer opened this issue Mar 19, 2024 · 4 comments

Comments

@EugenMayer
Copy link

First off, thank you for this awesome project!

I would love to see the image publish on ghrc.io - should i create a PR for that?

Reasoning: rate limits on docker hub apply extra effort and hassle.

@DarthSim
Copy link
Member

Hey @EugenMayer!

Yes, we're considering migrating to ghrc.io. PRs are always welcome!

@EugenMayer
Copy link
Author

Great!

I am trying to make sense of https://github.com/imgproxy/imgproxy/tree/master/.github and the workflow setup. Are you actually publishing your docker-hub images via actions and if yes, what is https://github.com/imgproxy/imgproxy/tree/master/.github/ci-docker ?

@DarthSim
Copy link
Member

c-docker is the Docker image that is used for CI tsaks (tests, lints). We're using Google Cloud Run for builds: https://github.com/imgproxy/imgproxy/blob/master/cloudbuild.yaml

@EugenMayer
Copy link
Author

Well considering this, i will not be able to do anything practical then using a PR.

see https://docs.github.com/en/packages/working-with-a-github-packages-registry/working-with-the-container-registry#authenticating-with-a-personal-access-token-classic

export CR_PAT=YOUR_TOKEN
echo $CR_PAT | docker login ghcr.io -u USERNAME --password-stdin

now tag the image

export GHCR_TAG=ghcr.io/imgproxy/imgproxy:$TAG
docker tag $HUBIMAGE ghcr.io/imgproxy/imgproxy:$GHCR_TAG
docker push $GHCR_TAG

There is not much i can provide here, i have no experience with google runners. Doing the entire thing as github action is trivial. This would be tag-release based and token handling is automatic.

name: build-and-push

on:
  push:
    tags:
      - '*'

env:
  IMAGE_FQDN: ghcr.io/imgproxy/imgproxy

jobs:
  docker:
    runs-on: ubuntu-latest
    steps:
      - name: Checkout
        uses: actions/checkout@v3
      - name: Set up QEMU
        uses: docker/setup-qemu-action@v2
      - name: Set up Docker Buildx
        uses: docker/setup-buildx-action@v2
      - name: Login to GHCR
        uses: docker/login-action@v2
        with:
          registry: ghcr.io
          username: ${{ github.repository_owner }}
          password: ${{ github.token }}
      # push only on main
      - name: Build and push
        uses: docker/build-push-action@v3
        with:
          context: .
          platforms: linux/amd64
          push: true
          tags: | 
            ${{ env.IMAGE_FQDN }}:latest
            ${{ env.IMAGE_FQDN }}:${{ github.ref_name }}
          build-args: |
            TRAEFIK_VERSION=${{ github.ref_name }}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants