fix: Convert Docker image names to lowercase in GitHub Actions
This commit is contained in:
@@ -54,8 +54,11 @@ jobs:
|
|||||||
type=sha,prefix={{branch}}-,format=short
|
type=sha,prefix={{branch}}-,format=short
|
||||||
# Tag with date
|
# Tag with date
|
||||||
type=raw,value={{branch}}-{{date 'YYYYMMDD-HHmmss'}}
|
type=raw,value={{branch}}-{{date 'YYYYMMDD-HHmmss'}}
|
||||||
|
flavor: |
|
||||||
|
latest=false
|
||||||
|
|
||||||
- name: Build and push Linux Docker image
|
- name: Build and push Linux Docker image
|
||||||
|
id: build
|
||||||
uses: docker/build-push-action@v5
|
uses: docker/build-push-action@v5
|
||||||
with:
|
with:
|
||||||
context: .
|
context: .
|
||||||
@@ -105,19 +108,33 @@ jobs:
|
|||||||
# Tag with commit sha
|
# Tag with commit sha
|
||||||
type=sha,prefix={{branch}}-windows-,format=short
|
type=sha,prefix={{branch}}-windows-,format=short
|
||||||
# Tag with date
|
# Tag with date
|
||||||
type=raw,value={{branch}}-windows-{{date 'YYYYMMDD-HHmmss'}}
|
flavor: |
|
||||||
|
latest=false
|
||||||
|
|
||||||
- name: Build and push Windows Docker image
|
- name: Build and push Windows Docker image
|
||||||
run: |
|
run: |
|
||||||
docker build -t ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ steps.meta.outputs.version }}-windows -f Dockerfile.windows .
|
# Convert repository name to lowercase
|
||||||
|
$imageName = "${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}".ToLower()
|
||||||
|
|
||||||
|
# Build with temporary tag
|
||||||
|
docker build -t "${imageName}:temp-windows" -f Dockerfile.windows .
|
||||||
|
|
||||||
|
# Parse and push all tags
|
||||||
$tags = "${{ steps.meta.outputs.tags }}" -split "`n"
|
$tags = "${{ steps.meta.outputs.tags }}" -split "`n"
|
||||||
foreach ($tag in $tags) {
|
foreach ($tag in $tags) {
|
||||||
$tag = $tag.Trim()
|
$tag = $tag.Trim()
|
||||||
if ($tag) {
|
if ($tag) {
|
||||||
docker tag ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ steps.meta.outputs.version }}-windows $tag
|
# Ensure tag is lowercase
|
||||||
|
$tag = $tag.ToLower()
|
||||||
|
Write-Host "Tagging and pushing: $tag"
|
||||||
|
docker tag "${imageName}:temp-windows" $tag
|
||||||
docker push $tag
|
docker push $tag
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# Remove temporary tag
|
||||||
|
docker rmi "${imageName}:temp-windows" }
|
||||||
|
}
|
||||||
shell: pwsh
|
shell: pwsh
|
||||||
|
|
||||||
create-manifest:
|
create-manifest:
|
||||||
@@ -125,23 +142,26 @@ jobs:
|
|||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
needs: [build-linux, build-windows]
|
needs: [build-linux, build-windows]
|
||||||
permissions:
|
permissions:
|
||||||
contents: read
|
contIMAGE_LOWER=$(echo "${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}" | tr '[:upper:]' '[:lower:]')
|
||||||
packages: write
|
docker buildx imagetools create -t ${IMAGE_LOWER}:latest \
|
||||||
|
${IMAGE_LOWER}:latest \
|
||||||
steps:
|
${IMAGE_LOWER}:latest-windows
|
||||||
- name: Log in to GitHub Container Registry
|
|
||||||
uses: docker/login-action@v3
|
|
||||||
with:
|
|
||||||
registry: ${{ env.REGISTRY }}
|
|
||||||
username: ${{ github.actor }}
|
|
||||||
password: ${{ secrets.GITHUB_TOKEN }}
|
|
||||||
|
|
||||||
- name: Create and push manifest for main branch
|
- name: Create and push manifest for dev branch
|
||||||
if: github.ref == 'refs/heads/main'
|
if: github.ref == 'refs/heads/dev'
|
||||||
run: |
|
run: |
|
||||||
docker buildx imagetools create -t ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:latest \
|
IMAGE_LOWER=$(echo "${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}" | tr '[:upper:]' '[:lower:]')
|
||||||
${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:latest \
|
docker buildx imagetools create -t ${IMAGE_LOWER}:dev-latest \
|
||||||
${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:latest-windows
|
${IMAGE_LOWER}:dev-latest \
|
||||||
|
${IMAGE_LOWER}:dev-latest-windows
|
||||||
|
|
||||||
|
- name: Create and push manifest for staging branch
|
||||||
|
if: github.ref == 'refs/heads/staging'
|
||||||
|
run: |
|
||||||
|
IMAGE_LOWER=$(echo "${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}" | tr '[:upper:]' '[:lower:]')
|
||||||
|
docker buildx imagetools create -t ${IMAGE_LOWER}:staging-latest \
|
||||||
|
${IMAGE_LOWER}:staging-latest \
|
||||||
|
${IMAGE_LOWER}:latest-windows
|
||||||
|
|
||||||
- name: Create and push manifest for dev branch
|
- name: Create and push manifest for dev branch
|
||||||
if: github.ref == 'refs/heads/dev'
|
if: github.ref == 'refs/heads/dev'
|
||||||
|
|||||||
Reference in New Issue
Block a user