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
|
||||
# Tag with date
|
||||
type=raw,value={{branch}}-{{date 'YYYYMMDD-HHmmss'}}
|
||||
flavor: |
|
||||
latest=false
|
||||
|
||||
- name: Build and push Linux Docker image
|
||||
id: build
|
||||
uses: docker/build-push-action@v5
|
||||
with:
|
||||
context: .
|
||||
@@ -105,19 +108,33 @@ jobs:
|
||||
# Tag with commit sha
|
||||
type=sha,prefix={{branch}}-windows-,format=short
|
||||
# Tag with date
|
||||
type=raw,value={{branch}}-windows-{{date 'YYYYMMDD-HHmmss'}}
|
||||
flavor: |
|
||||
latest=false
|
||||
|
||||
- name: Build and push Windows Docker image
|
||||
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"
|
||||
foreach ($tag in $tags) {
|
||||
$tag = $tag.Trim()
|
||||
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
|
||||
}
|
||||
}
|
||||
|
||||
# Remove temporary tag
|
||||
docker rmi "${imageName}:temp-windows" }
|
||||
}
|
||||
shell: pwsh
|
||||
|
||||
create-manifest:
|
||||
@@ -125,23 +142,26 @@ jobs:
|
||||
runs-on: ubuntu-latest
|
||||
needs: [build-linux, build-windows]
|
||||
permissions:
|
||||
contents: read
|
||||
packages: write
|
||||
|
||||
steps:
|
||||
- name: Log in to GitHub Container Registry
|
||||
uses: docker/login-action@v3
|
||||
with:
|
||||
registry: ${{ env.REGISTRY }}
|
||||
username: ${{ github.actor }}
|
||||
password: ${{ secrets.GITHUB_TOKEN }}
|
||||
contIMAGE_LOWER=$(echo "${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}" | tr '[:upper:]' '[:lower:]')
|
||||
docker buildx imagetools create -t ${IMAGE_LOWER}:latest \
|
||||
${IMAGE_LOWER}:latest \
|
||||
${IMAGE_LOWER}:latest-windows
|
||||
|
||||
- name: Create and push manifest for main branch
|
||||
if: github.ref == 'refs/heads/main'
|
||||
- name: Create and push manifest for dev branch
|
||||
if: github.ref == 'refs/heads/dev'
|
||||
run: |
|
||||
docker buildx imagetools create -t ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:latest \
|
||||
${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:latest \
|
||||
${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:latest-windows
|
||||
IMAGE_LOWER=$(echo "${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}" | tr '[:upper:]' '[:lower:]')
|
||||
docker buildx imagetools create -t ${IMAGE_LOWER}:dev-latest \
|
||||
${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
|
||||
if: github.ref == 'refs/heads/dev'
|
||||
|
||||
Reference in New Issue
Block a user