👷 Fix docker ci build

This commit is contained in:
omg-xtao 2023-01-16 14:05:54 +08:00 committed by GitHub
parent 44125f4b19
commit 782d9fce51
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -38,37 +38,12 @@ jobs:
- name: Build - name: Build
run: | run: |
declare -a IMAGES
echo "Build amd64"
docker buildx build \ docker buildx build \
--cache-from "type=local,src=/tmp/.buildx-cache" \ --cache-from "type=local,src=/tmp/.buildx-cache" \
--cache-to "type=local,dest=/tmp/.buildx-cache" \ --cache-to "type=local,dest=/tmp/.buildx-cache" \
--output "type=image,push=true" \ --output "type=image,push=true" \
--platform linux/amd64 \ --platform "linux/amd64,linux/arm64/v8" \
--build-arg "S6_ARCH=amd64" \ --build-arg "S6_ARCH=amd64" \
--tag "${DOCKERHUB_REPOSITORY}:latest-amd64" \ --tag "${DOCKERHUB_REPOSITORY}:latest" \
-f Dockerfile \ -f Dockerfile \
. .
IMAGES+=( "${DOCKERHUB_REPOSITORY}:latest-amd64" )
echo "Build arm64-v8"
docker buildx build \
--cache-from "type=local,src=/tmp/.buildx-cache" \
--cache-to "type=local,dest=/tmp/.buildx-cache" \
--output "type=image,push=true" \
--platform linux/arm64/v8 \
--build-arg "S6_ARCH=aarch64" \
--tag "${DOCKERHUB_REPOSITORY}:latest-arm64-v8" \
-f Dockerfile \
.
IMAGES+=( "${DOCKERHUB_REPOSITORY}:latest-arm64-v8" )
echo "Create manifest lists"
docker manifest create "${DOCKERHUB_REPOSITORY}:latest" "${IMAGES[@]}"
echo "Annotate manifest lists to add architecture variants that aren't picked up automatically"
docker manifest annotate "${DOCKERHUB_REPOSITORY}:latest" "${DOCKERHUB_REPOSITORY}:latest-arm64-v8" --variant "v8"
echo "Push manifest lists & delete local copies"
docker manifest push --purge "${DOCKERHUB_REPOSITORY}:latest"