docker / docker/metadata-action

Handle multiple prefixes with Bake

Open
#124 8 comments 3 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
TypeScript
Stars
1.1k
Forks
160
Avg merge
4d 17h
Merged PRs (30d)
12

Description

Let's say I have a Dockerfile like so:

FROM debian:latest AS debian

[...]


# debian is the default
FROM debian


FROM ubuntu:latest AS ubuntu

[...]


FROM alpine:latest AS alpine

[...]

And a docker-bake.hcl like so:

group "default" {
  targets = ["debian"]
}

group "all" {
  targets = ["debian", "ubuntu", "alpine", "centos"]
}

target "base" {
  context = "."
}

target "debian" {
  inherits = ["base"]
  target = "debian"
}

target "ubuntu" {
  inherits = ["base"]
  target = "ubuntu"
}

target "alpine" {
  inherits = ["base"]
  target = "alpine"
}

Any suggestions on how could I integrate the Metadata Action with the Bake Action so I would have tags generated with prefixes like:

my-image:latest # debian
my-image:debian
my-image:ubuntu
my-image:alpine

And of course, tagging with semver like my-image:alpine-1.1.0.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the Dockerfile stages and the docker-bake.hcl targets shown in the issue, then review how the Metadata Action and Bake Action are configured together. Define how each Bake target should receive prefixed image tags, including semver tags, and verify the default and all groups produce the requested tag set.

Written by the indexing model from the issue text.

Assessment

Tech stack
docker, github-actions
Domain
devops
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.