-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
Image publishing to DockerHub is misconfigured #3917
Comments
Thank you for the report, setting up gorelease can be immensely painful and frustrating so I'm happy it works at all at the moment 😓 You can find the base config here: https://github.com/ory/xgoreleaser/blob/master/build.tmpl.yml |
In 2025 do you still think it's worth publishing ARM v7 and v6 binaries for releases? In a project I maintain (15k stars mail-server dockerized service), we dropped ARM v7 support back in Dec 2022. There was a few users still interested IIRC, but no major complaints declaring the platform legacy and for those users to build the project themselves or spend say $50 to replace that hardware. Might be worth considering for Ory to take the same stance going forward? Usually I see projects on Github publish for a wide variety of platforms on GH Releases just because the build platform / CI can support it, rather than actual demand for the more esoteric platforms published. You should be able to drop the entire dockers config from there shaving almost 200 lines away. The image labels assigned could be part of your It's up to you if you want to keep building Hydra via GoReleaser and copy the binary during the image build, otherwise the Docker images build + publish could be managed entirely separately if that's simpler to grok and maintain. I am not familiar with CoSign and your usage with it for Docker, but I assume that's related to the random digest This would need some tweaking, and I've not accounted for the It's split into two to keep the trigger workflow for your repo small and simple, with the dynamic inputs clearly visible under the name: 'Build and Publish Docker Images'
on:
workflow_dispatch:
push:
branches:
- master
# Optional: Only trigger this workflow if the push event
# involves files matching these path patterns:
paths:
- src/**
- .dockerignore
- Dockerfile
# Release tags as an alternative trigger to branch push,
# For example, when creating a GH Release which adds a tag:
tags:
- 'v*.*.*'
permissions:
contents: read
packages: write
jobs:
docker:
name: 'Deploy Docker Images'
uses: ory/hydra/.github/workflows/generic_publish.yml@master
with:
project-name: hydra
revision: ${{ github.sha }}
source: https://github.com/${{ github.repository }}
version: ${{ github.ref_type == 'tag' && github.ref_name || 'edge' }}
secrets: inherit name: 'Build and Publish the Docker Image'
on:
workflow_call:
inputs:
image-variant:
required: false
type: string
project-name:
required: true
type: string
revision:
required: true
type: string
source:
required: true
type: string
version:
required: true
type: string
permissions:
contents: read
packages: write
jobs:
publish-images:
name: 'Build and Publish'
runs-on: ubuntu-latest
steps:
- name: "Get current timestamp (ISO 8601)"
id: build-info
run: echo "date=$(date --utc --iso-8601=seconds)" >> "${GITHUB_OUTPUT}"
- name: 'Checkout'
uses: actions/checkout@v4
# This step will support building non-native platform archs via emulation (slow)
# Skip this when you can compile for that platform natively, or cross-compile (Zig, Go)
- name: 'Set up QEMU'
uses: docker/setup-qemu-action@v3
with:
platforms: arm64
- name: 'Set up Docker Buildx'
uses: docker/setup-buildx-action@v3
# The metadata action appends labels and sets the image names + tags to publish.
# Tags for the image to be published, based on the following rules:
# https://github.com/docker/metadata-action?tab=readme-ov-file#typeedge
# https://github.com/docker/metadata-action?tab=readme-ov-file#typesemver
# Updates to master branch will publish an image with the `:edge` tag (useful between official releases)
# Pushing a git tag will publish an image with all 3 semver tags
#
# NOTE: Publishing the semver tags like this is useful for software that monitors an image
# for updates only by a digest change to the image tag at the registry, like WatchTower does:
# https://github.com/containrrr/watchtower/issues/1802
#
# NOTE: By default the `:latest` image tag will be updated for the `semver` type below,
# you may want to have more control over that if your release policy could publish a patch
# release to an older major/minor release (as this would unintentionally update the latest tag too):
# https://github.com/docker/metadata-action?tab=readme-ov-file#latest-tag
- name: 'Prepare tags'
id: docker-metadata
uses: docker/metadata-action@v5
with:
images: |
docker.io/oryd/${{ inputs.project-name }}
ghcr.io/ory/${{ inputs.project-name }}
tags: |
type=edge,branch=master
type=semver,pattern=v{{major}}
type=semver,pattern=v{{major}}.{{minor}}
type=semver,pattern=v{{major}}.{{minor}}.{{patch}}
labels: |
org.opencontainers.image.created=${{ steps.build-info.outputs.date }}
org.opencontainers.image.title=${{ inputs.project-name }}
org.opencontainers.image.revision=${{ inputs.revision }}
org.opencontainers.image.source=${{ inputs.source }}
org.opencontainers.image.version=${{ inputs.version }}
org.opencontainers.image.vendor=Ory
org.opencontainers.image.url=https://www.ory.sh
org.opencontainers.image.documentation=https://www.ory.sh/docs
# Publish to image registries (DockerHub and GHCR):
- name: 'Login to DockerHub'
uses: docker/login-action@v3
with:
registry: docker.io
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: 'Login to GitHub Container Registry'
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
# Build the image from a Dockerfile for the requested platforms,
# then publish a multi-platform image at the registries with the tags and labels declared above
- name: 'Build and publish images'
uses: docker/build-push-action@v6
with:
context: .
# Customize any Dockerfile ARG values here:
build-args: |
BASE_IMAGE=${{ inputs.image-variant }}
platforms: linux/amd64,linux/arm64
push: true
labels: ${{ steps.docker-metadata.outputs.labels }}
tags: ${{ steps.docker-metadata.outputs.tags }}
# Disable provenance attestation: https://docs.docker.com/build/attestations/slsa-provenance/
provenance: false NOTE:
|
Preflight checklist
Ory Network Project
No response
Describe the bug
Presently (probably since the introduction of GoReleaser for this task?) the DockerHub image registry has:
Originally reported here: #3914 (comment)
It would be ideal if that was cleaned up, or at least a fix to prevent publishing this tags in future releases.
Reproducing the bug
Visit DockerHub for
oryd/hydra
Relevant log output
No response
Relevant configuration
No response
Version
2.2.0
On which operating system are you observing this issue?
None
In which environment are you deploying?
None
Additional Context
As a potential solution that is known to work without the undesirable tags being pushed, see the original report for advice on publishing the image via Github Actions.
Additional improvements:
oryd/hydra
, but could also provide a link to the page as a minor convenience to the reader. Likewise on this repo README ("Get Started" and "Develop" sections for Docker, or more commonly via another badge at the top of the README)-distroless
suffix in the tag provides an image variant using Google's Distroless (Minimal Debian base image without a package manager).The text was updated successfully, but these errors were encountered: