Fix Docker push

It seems we need to use `docker import` with the output from `docker
buildx` rather than `docker load` like we were doing when we used
`docker save`.
This commit is contained in:
Asher 2021-07-16 16:24:50 -05:00
parent 52579f182d
commit 8608d8ec74
No known key found for this signature in database
GPG Key ID: D63C1EF81242354A
1 changed files with 23 additions and 22 deletions

View File

@ -1,6 +1,27 @@
#!/usr/bin/env bash #!/usr/bin/env bash
set -euo pipefail set -euo pipefail
# Import and push the Docker image for the provided arch.
push() {
local arch=$1
local tag="codercom/code-server-$arch:$VERSION"
docker import "./release-images/code-server-$arch-$VERSION.tar" "$tag"
# We have to ensure the images exists on the remote registry in order to build
# the manifest. We don't put the arch in the tag to avoid polluting the main
# repository. These other repositories are private so they don't pollute our
# organization namespace.
docker push "$tag"
export DOCKER_CLI_EXPERIMENTAL=enabled
docker manifest create "codercom/code-server:$VERSION" \
"codercom/code-server-$arch:$VERSION" \
"codercom/code-server-$arch:$VERSION"
docker manifest push --purge "codercom/code-server:$VERSION"
}
main() { main() {
cd "$(dirname "$0")/../.." cd "$(dirname "$0")/../.."
source ./ci/lib.sh source ./ci/lib.sh
@ -10,28 +31,8 @@ main() {
echo "$DOCKER_PASSWORD" | docker login -u "$DOCKER_USERNAME" --password-stdin echo "$DOCKER_PASSWORD" | docker login -u "$DOCKER_USERNAME" --password-stdin
fi fi
for img in ./release-images/*; do push "amd64"
docker load -i "$img" push "arm64"
done
# We have to ensure the amd64 and arm64 images exist on the remote registry
# in order to build the manifest.
# We don't put the arch in the tag to avoid polluting the main repository.
# These other repositories are private so they don't pollute our organization namespace.
docker push "codercom/code-server-amd64:$VERSION"
docker push "codercom/code-server-arm64:$VERSION"
export DOCKER_CLI_EXPERIMENTAL=enabled
docker manifest create "codercom/code-server:$VERSION" \
"codercom/code-server-amd64:$VERSION" \
"codercom/code-server-arm64:$VERSION"
docker manifest push --purge "codercom/code-server:$VERSION"
docker manifest create "codercom/code-server:latest" \
"codercom/code-server-amd64:$VERSION" \
"codercom/code-server-arm64:$VERSION"
docker manifest push --purge "codercom/code-server:latest"
} }
main "$@" main "$@"