content: # Copyright 2024 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
  #
  #     http://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.
  
  # Base Image
  FROM nvcr.io/nvidia/nemo:24.07
  
  # Set the working directory
  WORKDIR /workspace
  COPY requirements.txt /workspace/requirements.txt
  
  # GCSfuse components (used to provide shared storage, not intended for high performance)
  RUN apt-get update && apt-get install --yes --no-install-recommends \
      ca-certificates \
      curl \
      gnupg \
    && echo "deb https://packages.cloud.google.com/apt gcsfuse-buster main" \
      | tee /etc/apt/sources.list.d/gcsfuse.list \
    && echo "deb https://packages.cloud.google.com/apt cloud-sdk main" \
      | tee -a /etc/apt/sources.list.d/google-cloud-sdk.list \
    && curl https://packages.cloud.google.com/apt/doc/apt-key.gpg | apt-key add - \
    && apt-get update \
    && apt-get install --yes gcsfuse \
    && apt-get install --yes google-cloud-cli \
    && apt-get clean && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* \
    && mkdir /gcs
  
  RUN pip install --require-hashes -r requirements.txt
  
  # install kubectl
  RUN curl -LO https://storage.googleapis.com/kubernetes-release/release/$(curl -s https://storage.googleapis.com/kubernetes-release/release/stable.txt)/bin/linux/amd64/kubectl
  RUN chmod +x ./kubectl
  RUN mv ./kubectl /usr/local/bin
  
  # Clone the AotC repository
  RUN git clone https://github.com/AI-Hypercomputer/aotc.git
  WORKDIR /workspace/aotc
  
  # Build the wheel
  RUN pip install build setuptools
  RUN python3 -m pip wheel . --no-deps -w dist/
  RUN pip install dist/*.whl
  
  # Add the build timestamp as a label
  ARG BUILD_TIMESTAMP
  LABEL build_timestamp=$BUILD_TIMESTAMP
  
  ENTRYPOINT []