|
| 1 | +# Copyright 2024 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 | +from ubuntu:24.04 |
| 16 | + |
| 17 | +ENV DEBIAN_FRONTEND noninteractive |
| 18 | + |
| 19 | +# Ensure local Python is preferred over distribution Python. |
| 20 | +ENV PATH /usr/local/bin:$PATH |
| 21 | + |
| 22 | +# Install dependencies. |
| 23 | +RUN apt-get update \ |
| 24 | + && apt-get install -y --no-install-recommends \ |
| 25 | + apt-transport-https \ |
| 26 | + build-essential \ |
| 27 | + ca-certificates \ |
| 28 | + curl \ |
| 29 | + dirmngr \ |
| 30 | + git \ |
| 31 | + gpg-agent \ |
| 32 | + graphviz \ |
| 33 | + libbz2-dev \ |
| 34 | + libdb5.3-dev \ |
| 35 | + libexpat1-dev \ |
| 36 | + libffi-dev \ |
| 37 | + liblzma-dev \ |
| 38 | + libreadline-dev \ |
| 39 | + libsnappy-dev \ |
| 40 | + libssl-dev \ |
| 41 | + libsqlite3-dev \ |
| 42 | + portaudio19-dev \ |
| 43 | + redis-server \ |
| 44 | + software-properties-common \ |
| 45 | + ssh \ |
| 46 | + sudo \ |
| 47 | + tcl \ |
| 48 | + tcl-dev \ |
| 49 | + tk \ |
| 50 | + tk-dev \ |
| 51 | + uuid-dev \ |
| 52 | + wget \ |
| 53 | + zlib1g-dev \ |
| 54 | + && add-apt-repository universe \ |
| 55 | + && apt-get update \ |
| 56 | + && apt-get -y install jq \ |
| 57 | + && apt-get clean autoclean \ |
| 58 | + && apt-get autoremove -y \ |
| 59 | + && rm -rf /var/lib/apt/lists/* \ |
| 60 | + && rm -f /var/cache/apt/archives/*.deb |
| 61 | + |
| 62 | + |
| 63 | +###################### Install python 3.10.14 for docs/docfx session |
| 64 | + |
| 65 | +# Download python 3.10.14 |
| 66 | +RUN wget https://www.python.org/ftp/python/3.10.14/Python-3.10.14.tgz |
| 67 | + |
| 68 | +# Extract files |
| 69 | +RUN tar -xvf Python-3.10.14.tgz |
| 70 | + |
| 71 | +# Install python 3.10.14 |
| 72 | +RUN ./Python-3.10.14/configure --enable-optimizations |
| 73 | +RUN make altinstall |
| 74 | + |
| 75 | +ENV PATH /usr/local/bin/python3.10:$PATH |
| 76 | + |
| 77 | +###################### Install pip |
| 78 | +RUN wget -O /tmp/get-pip.py'https://bootstrap.pypa.io/get-pip.py' \ |
| 79 | + && python3.10 /tmp/get-pip.py \ |
| 80 | + && rm /tmp/get-pip.py |
| 81 | + |
| 82 | +# Test pip |
| 83 | +RUN python3.10 -m pip |
| 84 | + |
| 85 | +# Install build requirements |
| 86 | +COPY requirements.txt /requirements.txt |
| 87 | +RUN python3.10 -m pip install --require-hashes -r requirements.txt |
| 88 | + |
| 89 | +CMD ["python3.10"] |