|
| 1 | +# Copyright 2025 Google LLC |
| 2 | +# |
| 3 | +# Licensed under the Apache License, Version 2.0 (the "License"); |
| 4 | +# you may not use this file except in compliance with the License. |
| 5 | +# You may obtain a copy of the License at |
| 6 | +# |
| 7 | +# http://www.apache.org/licenses/LICENSE-2.0 |
| 8 | +# |
| 9 | +# Unless required by applicable law or agreed to in writing, software |
| 10 | +# distributed under the License is distributed on an "AS IS" BASIS, |
| 11 | +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 12 | +# See the License for the specific language governing permissions and |
| 13 | +# limitations under the License. |
| 14 | + |
| 15 | + |
| 16 | +FROM alpine/git:2.47.2 AS maxtext_cloner |
| 17 | + |
| 18 | +ARG MAXTEXT_COMMIT_HASH |
| 19 | + |
| 20 | +WORKDIR /src |
| 21 | + |
| 22 | +RUN \ |
| 23 | + git clone --depth=1 https://github.com/AI-Hypercomputer/maxtext.git && \ |
| 24 | + if [ -n "${MAXTEXT_COMMIT_HASH}" ]; then \ |
| 25 | + cd maxtext && \ |
| 26 | + git fetch origin ${MAXTEXT_COMMIT_HASH} && \ |
| 27 | + git switch --detach ${MAXTEXT_COMMIT_HASH}; \ |
| 28 | + fi |
| 29 | + |
| 30 | + |
| 31 | +FROM alpine/git:2.47.2 AS jetstream_cloner |
| 32 | + |
| 33 | +ARG JETSTREAM_COMMIT_HASH |
| 34 | + |
| 35 | +WORKDIR /src |
| 36 | +RUN \ |
| 37 | + git clone --depth=1 https://github.com/AI-Hypercomputer/JetStream.git && \ |
| 38 | + if [ -n "${JETSTREAM_COMMIT_HASH}" ]; then \ |
| 39 | + cd JetStream && \ |
| 40 | + git fetch origin ${JETSTREAM_COMMIT_HASH} && \ |
| 41 | + git switch --detach ${JETSTREAM_COMMIT_HASH}; \ |
| 42 | + fi |
| 43 | + |
| 44 | +FROM python:3.10-slim-bullseye AS runner |
| 45 | + |
| 46 | +WORKDIR /jetstream_maxtext_stable_stack |
| 47 | + |
| 48 | +# Environment variable for no-cache-dir and pip root user warning |
| 49 | +ENV PIP_NO_CACHE_DIR=1 |
| 50 | +ENV PIP_ROOT_USER_ACTION=ignore |
| 51 | + |
| 52 | +# Set environment variables for Google Cloud SDK and Python 3.10 |
| 53 | +ENV PYTHON_VERSION=3.10 |
| 54 | +ENV CLOUD_SDK_VERSION=latest |
| 55 | + |
| 56 | +# Set DEBIAN_FRONTEND to noninteractive to avoid frontend errors |
| 57 | +ENV DEBIAN_FRONTEND=noninteractive |
| 58 | + |
| 59 | +RUN apt-get update \ |
| 60 | + && \ |
| 61 | + apt-get install -y --no-install-recommends git git-lfs \ |
| 62 | + && \ |
| 63 | + rm -rf /var/lib/apt/lists/* |
| 64 | + |
| 65 | +RUN python3 -m pip install --upgrade pip |
| 66 | + |
| 67 | +# Install MaxText package |
| 68 | +COPY --from=maxtext_cloner /src . |
| 69 | +RUN cd maxtext && bash setup.sh |
| 70 | + |
| 71 | +# MaxText install jetstream from the main. Need overwrite it. |
| 72 | +# Install JetStream requirements |
| 73 | +COPY --from=jetstream_cloner /src . |
| 74 | +RUN python3 -m pip install ./JetStream |
| 75 | +RUN python3 -m pip install -r ./JetStream/benchmarks/requirements.in |
| 76 | + |
| 77 | +COPY generate_manifest.sh . |
| 78 | +RUN \ |
| 79 | + bash ./generate_manifest.sh \ |
| 80 | + PREFIX=jetstream_maxtext \ |
| 81 | + MAXTEXT_COMMIT_HASH=$(git -C ./maxtext rev-parse HEAD) \ |
| 82 | + JETSTREAM_COMMIT_HASH=$(git -C ./JetStream rev-parse HEAD) |
0 commit comments