Skip to content

Commit

Permalink
test: docker meta tags
Browse files Browse the repository at this point in the history
  • Loading branch information
adamblake committed Jan 8, 2025
1 parent c3dcbd8 commit 2b342ed
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 5 deletions.
17 changes: 12 additions & 5 deletions .github/workflows/bake.yml
Original file line number Diff line number Diff line change
Expand Up @@ -68,20 +68,27 @@ jobs:
# - name: Set up QEMU
# uses: docker/setup-qemu-action@v3

# - name: Set up Docker Buildx
# uses: docker/setup-buildx-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Image Metadata
id: meta
uses: docker/metadata-action@v5
with:
# images: |
# ${{ github.repository_owner }}/${{ inputs.target }}
# ghcr.io/${{ github.repository_owner }}/${{ inputs.target }}
tags: |
type=raw,value=latest,enable={{is_default_branch}}
type=schedule,pattern={{date 'YYYY-MM-DD'}}
type=sha
type=raw,value=r-4.3.3
- name: Test Bake
run: |
TAG_LIST=${DOCKER_METADATA_OUTPUT_TAGS} \
docker buildx bake \
-f docker-bake.hcl \
-f ${{ steps.meta.outputs.bake-file-labels }} \
--print \
default
# - name: Build and push
# uses: docker/bake-action@v5
Expand Down
8 changes: 8 additions & 0 deletions docker-bake.hcl
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@ variable "TAG" {
default = "test"
}

variable "TAG_LIST" {
default = "test"
}

function "tags" {
params = [name, suffix]
result = ["${REGISTRY}/${name}:${TAG}${suffix}"]
Expand Down Expand Up @@ -41,7 +45,10 @@ function "cache-to" {
]
}

target "docker-metadata-action" {}

target "default" {
inherits = ["docker-metadata-action"]
context = "."
secret = ["type=env,id=GITHUB_TOKEN"]
labels = {
Expand All @@ -51,6 +58,7 @@ target "default" {
"org.opencontainers.image.vendor": "CourseKata",
"org.opencontainers.image.authors": "Adam Blake <[email protected]>"
}
tags = [ for t in split(",", "${TAG_LIST}") : "myimage:${t}" ]
}

target "amd64" {
Expand Down

0 comments on commit 2b342ed

Please sign in to comment.