tag_latest.sh 1.2 KB

123456789101112131415161718192021222324252627282930313233
  1. #!/bin/sh
  2. set -eu
  3. # We use 2 different image repositories to handle combining architecture images into multiarch manifest
  4. # (The ROCm image is x86 only and is not a multiarch manifest)
  5. # For developers, you can override the DOCKER_ORG to generate multiarch manifests
  6. # DOCKER_ORG=jdoe VERSION=0.1.30 PUSH=1 ./scripts/tag_latest.sh
  7. DOCKER_ORG=${DOCKER_ORG:-"ollama"}
  8. RELEASE_IMAGE_REPO=${RELEASE_IMAGE_REPO:-"${DOCKER_ORG}/release"}
  9. FINAL_IMAGE_REPO=${FINAL_IMAGE_REPO:-"${DOCKER_ORG}/ollama"}
  10. # Set PUSH to a non-empty string to trigger push instead of load
  11. PUSH=${PUSH:-""}
  12. echo "Assembling manifest and tagging latest"
  13. docker manifest rm ${FINAL_IMAGE_REPO}:latest || true
  14. docker manifest create ${FINAL_IMAGE_REPO}:latest \
  15. ${RELEASE_IMAGE_REPO}:$VERSION-amd64 \
  16. ${RELEASE_IMAGE_REPO}:$VERSION-arm64
  17. docker pull ${RELEASE_IMAGE_REPO}:$VERSION-rocm
  18. docker tag ${RELEASE_IMAGE_REPO}:$VERSION-rocm ${FINAL_IMAGE_REPO}:rocm
  19. if [ -n "${PUSH}" ]; then
  20. echo "Pushing latest tags up..."
  21. docker manifest push ${FINAL_IMAGE_REPO}:latest
  22. docker push ${FINAL_IMAGE_REPO}:rocm
  23. else
  24. echo "Not pushing ${FINAL_IMAGE_REPO}:latest and ${FINAL_IMAGE_REPO}:rocm"
  25. fi