DataDog / images-rb

Ruby-specific Docker images
Other
1 stars 0 forks source link

Publish images for service container #15

Open TonyCTHsu opened 3 days ago

TonyCTHsu commented 3 days ago

Why

Pulling images from ghcr.io is more reliable for automations in Github Actions. It also avoid hitting the rate limit threshold for Dockerhub.

Here is a list of images we used from https://github.com/DataDog/dd-trace-rb

lloeki commented 2 days ago

Essentially this would make this repo and its ghcr.io/datadog/images-rb registry a mirror, which is fine and in scope.

A corresponding directory structure and image naming scheme should be devised, e.g quick thinking:

src/mirror/
  hub.docker.com/     # is that it? or rather some `docker.io`, or just `docker`, or nothing?
    datadog/
      agent/
        latest/       # last component is the default base tag
          Dockerfile  # can contain `append-tags: 1.2.3`, but then should strip away the `latest` special case tag?
    elasticsearch/
      8.1/
        Dockerfile
    ...
  ghcr.io/
    datadog/
      dd-apm-test-agent/
        v1.12/
          Dockerfile
  ...

Tooling (docker.rake) might need to be slightly updated. CI workflow will probably need an overhaul and made more generic with reusable parts, which is on the table anyway for sustainability.

TonyCTHsu commented 1 day ago

A corresponding directory structure and image naming scheme should be devised

Do we really need this? I think it is quite straightforward with a YAML as https://github.com/DataDog/images/blob/master/mirror.yaml defined them.

images:
  - source: "docker.io/library/postgres:9.6"
    dest:
      repo: "postgres"
      tag: "9.6"

Not sure how it is done or if we can leverage the existing https://github.com/DataDog/images to do this (we might just need a simplified versions of it).

From what I understand, in order to build a mirror, we need a source and a destination and do something like:

docker pull docker.io/repository/image:tag
docker tag docker.io/repository/image:tag ghcr.io/USERNAME/IMAGE:TAG
docker push ghcr.io/USERNAME/IMAGE:TAG

Here is something interesting about https://github.com/DataDog/images