# Copyright 2023 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

options:
  dynamic_substitutions: true
steps:
- name: gcr.io/cloud-builders/docker
  env:
  - BASE_IMAGE=${_BASE_IMAGE}
  - MODEL_NAME=${_MODEL_NAME}
  - MODEL_VERSION=${_MODEL_VERSION}
  args:
  - buildx
  - build
  - --tag
  - ${_MODEL_IMAGE}
  - --build-arg
  - BASE_IMAGE
  - --build-arg
  - MODEL_NAME
  - --build-arg
  - MODEL_VERSION
  - "."
substitutions:
  _LOCATION: us-central1
  _MODEL_NAME: t5-small
  _MODEL_VERSION: "1.0"
  _MACHINE: cpu
  _MODEL_IMAGE: ${_LOCATION}-docker.pkg.dev/${PROJECT_ID}/models/${_MODEL_NAME}:${_MODEL_VERSION}-${_MACHINE}
  _BASE_IMAGE: pytorch/torchserve:0.7.1-${_MACHINE}
images:
- ${_MODEL_IMAGE}
