## This builds the docker image for L4T with the arm64 architecture
docker_builder:
  only_if: $CIRRUS_TAG != '' || $CIRRUS_BRANCH != ''
  env:
    CIRRUS_ARCH: arm64
    IMAGE_NAME: localai/localai
    DOCKER_USERNAME: ENCRYPTED[!944ba150d3a7a27f3a9b7d3cc0f481989907ddeea9391a345ec751b70de1620f064cce952491a2fe2b434b1b9e0270b2!]
    DOCKER_PASSWORD: ENCRYPTED[!2c9b4746de765859c11df043adafe1247876c7d535edc439eac66d8c1e88029b96e67a8023c36dfec30ee78ca5109089!]
  build_script: |
    BUILD_ARGS="--build-arg SKIP_DRIVERS=true --build-arg BUILD_TYPE=cublas --build-arg BASE_IMAGE=nvcr.io/nvidia/l4t-jetpack:r36.4.0 --build-arg IMAGE_TYPE=core"
    if [ -n "$CIRRUS_TAG" ]; then
      docker build $BUILD_ARGS --tag $IMAGE_NAME:$CIRRUS_TAG-nvidia-l4t-arm64-core .
      docker tag $IMAGE_NAME:$CIRRUS_TAG-nvidia-l4t-arm64-core $IMAGE_NAME:latest-nvidia-l4t-arm64-core
    else
      docker build $BUILD_ARGS --tag $IMAGE_NAME:$CIRRUS_BRANCH-nvidia-l4t-arm64-core .
    fi
  login_script: echo $DOCKER_PASSWORD | docker login -u $DOCKER_USERNAME --password-stdin
  push_script: |
    if [ -n "$CIRRUS_TAG" ]; then
      docker push $IMAGE_NAME:$CIRRUS_TAG-nvidia-l4t-arm64-core
      docker push $IMAGE_NAME:latest-nvidia-l4t-arm64-core
    else
      docker push $IMAGE_NAME:$CIRRUS_BRANCH-nvidia-l4t-arm64-core
    fi