mirror of
https://github.com/YuCat-OVO/BaiduNetdisk-Docker
synced 2025-05-10 20:10:04 +08:00
Build bake change
This commit is contained in:
parent
cbee6ee7f3
commit
4c954be688
22
.github/workflows/build.yml
vendored
22
.github/workflows/build.yml
vendored
@ -52,12 +52,6 @@ jobs:
|
|||||||
run: |
|
run: |
|
||||||
mv "${{ steps.meta.outputs.bake-file }}" "/tmp/bake-meta.json"
|
mv "${{ steps.meta.outputs.bake-file }}" "/tmp/bake-meta.json"
|
||||||
|
|
||||||
- name: Set up QEMU
|
|
||||||
uses: docker/setup-qemu-action@v3
|
|
||||||
|
|
||||||
- name: Set up Docker Buildx
|
|
||||||
uses: docker/setup-buildx-action@v3
|
|
||||||
|
|
||||||
- name: Upload meta bake definition
|
- name: Upload meta bake definition
|
||||||
uses: actions/upload-artifact@v4
|
uses: actions/upload-artifact@v4
|
||||||
with:
|
with:
|
||||||
@ -114,11 +108,13 @@ jobs:
|
|||||||
- name: Build
|
- name: Build
|
||||||
id: bake
|
id: bake
|
||||||
uses: docker/bake-action@v4
|
uses: docker/bake-action@v4
|
||||||
|
env:
|
||||||
|
PLATFORM: ${{ env.ARCH }}
|
||||||
with:
|
with:
|
||||||
files: |
|
files: |
|
||||||
./docker-bake.hcl
|
./docker-bake.hcl
|
||||||
/tmp/bake-meta.json
|
/tmp/bake-meta.json
|
||||||
targets: ${{ env.PLATFORM_PAIR }}
|
targets: image
|
||||||
set: |
|
set: |
|
||||||
*.tags=
|
*.tags=
|
||||||
*.platform=${{ matrix.platform }}
|
*.platform=${{ matrix.platform }}
|
||||||
@ -126,18 +122,10 @@ jobs:
|
|||||||
*.cache-to=type=gha,scope=build-${{ env.PLATFORM_PAIR }}
|
*.cache-to=type=gha,scope=build-${{ env.PLATFORM_PAIR }}
|
||||||
*.output=type=image,"name=${{ env.DOCKERHUB_SLUG }},${{ env.GHCR_SLUG }}",push-by-digest=true,name-canonical=true,push=true
|
*.output=type=image,"name=${{ env.DOCKERHUB_SLUG }},${{ env.GHCR_SLUG }}",push-by-digest=true,name-canonical=true,push=true
|
||||||
|
|
||||||
- name: Export digest (amd64)
|
- name: Export digest
|
||||||
if: matrix.platform == 'linux/amd64'
|
|
||||||
run: |
|
run: |
|
||||||
mkdir -p /tmp/digests
|
mkdir -p /tmp/digests
|
||||||
digest="${{ fromJSON(steps.bake.outputs.metadata).image-amd64['containerimage.digest'] }}"
|
digest="${{ fromJSON(steps.bake.outputs.metadata).image['containerimage.digest'] }}"
|
||||||
touch "/tmp/digests/${digest#sha256:}"
|
|
||||||
|
|
||||||
- name: Export digest (arm64)
|
|
||||||
if: matrix.platform == 'linux/arm64'
|
|
||||||
run: |
|
|
||||||
mkdir -p /tmp/digests
|
|
||||||
digest="${{ fromJSON(steps.bake.outputs.metadata).image-arm64['containerimage.digest'] }}"
|
|
||||||
touch "/tmp/digests/${digest#sha256:}"
|
touch "/tmp/digests/${digest#sha256:}"
|
||||||
|
|
||||||
- name: Upload digest
|
- name: Upload digest
|
||||||
|
|||||||
@ -2,24 +2,32 @@ variable "DEFAULT_TAG" {
|
|||||||
default = "baidunetdisk-docker:latest"
|
default = "baidunetdisk-docker:latest"
|
||||||
}
|
}
|
||||||
|
|
||||||
group "linux-amd64" {
|
variable "ARCH" {
|
||||||
targets = ["image-amd64"]
|
default = "arm64"
|
||||||
}
|
|
||||||
group "linux-arm64" {
|
|
||||||
targets = ["image-arm64"]
|
|
||||||
}
|
}
|
||||||
|
|
||||||
target "docker-metadata-action" {
|
target "docker-metadata-action" {
|
||||||
tags = ["${DEFAULT_TAG}"]
|
tags = ["${DEFAULT_TAG}"]
|
||||||
}
|
}
|
||||||
|
// Default target if none specified
|
||||||
|
group "default" {
|
||||||
|
targets = ["image-local"]
|
||||||
|
}
|
||||||
|
|
||||||
target "image-amd64" {
|
target "image" {
|
||||||
platforms = ["linux/amd64"]
|
|
||||||
inherits = ["docker-metadata-action"]
|
inherits = ["docker-metadata-action"]
|
||||||
dockerfile = "Dockerfile"
|
dockerfile = format("Dockerfile%s", equal("arm64", ARCH) ? "" : ".${ARCH}")
|
||||||
}
|
}
|
||||||
target "image-arm64" {
|
|
||||||
platforms = ["linux/arm64"]
|
target "image-local" {
|
||||||
inherits = ["docker-metadata-action"]
|
inherits = ["image"]
|
||||||
dockerfile = "Dockerfile.arm64"
|
output = ["type=docker"]
|
||||||
|
}
|
||||||
|
|
||||||
|
target "image-all" {
|
||||||
|
inherits = ["image"]
|
||||||
|
platforms = [
|
||||||
|
"linux/amd64",
|
||||||
|
"linux/arm64",
|
||||||
|
]
|
||||||
}
|
}
|
||||||
Loading…
Reference in New Issue
Block a user