|
16 | 16 |
|
17 | 17 | # build from the root of this repo: |
18 | 18 | # docker build -t gcr.io/repo-automation-bots/owlbot-python -f docker/owlbot/python/Dockerfile . |
19 | | -FROM python:3.10.6-buster |
| 19 | +FROM marketplace.gcr.io/google/ubuntu2404 |
20 | 20 |
|
21 | | -WORKDIR / |
| 21 | +RUN apt-get update && \ |
| 22 | + apt-get install -y --no-install-recommends \ |
| 23 | + # Essential for compiling C code |
| 24 | + build-essential \ |
| 25 | + git \ |
| 26 | + wget \ |
| 27 | + ca-certificates \ |
| 28 | + libssl-dev \ |
| 29 | + zlib1g-dev \ |
| 30 | + libbz2-dev \ |
| 31 | + libffi-dev \ |
| 32 | + libsqlite3-dev \ |
| 33 | + libreadline-dev \ |
| 34 | + # ------------------------------------------------------ |
| 35 | + && apt-get clean && \ |
| 36 | + rm -rf /var/lib/apt/lists/* |
22 | 37 |
|
23 | | -###################### Install python 3.8.11 |
| 38 | +# Install multiple Python versions from source. `make altinstall` is used to |
| 39 | +# prevent replacing the system's default python binary. |
| 40 | +# TODO(http://github.com/googleapis/gapic-generator-python/issues/2435): Remove `3.10.18` when the linked issue is resolved. |
| 41 | +RUN for PYTHON_VERSION in 3.10.18 3.13.5; do \ |
| 42 | + wget https://www.python.org/ftp/python/${PYTHON_VERSION}/Python-${PYTHON_VERSION}.tgz && \ |
| 43 | + tar -xvf Python-${PYTHON_VERSION}.tgz && \ |
| 44 | + cd Python-${PYTHON_VERSION} && \ |
| 45 | + ./configure --enable-optimizations --prefix=/usr/local && \ |
| 46 | + make -j$(nproc) && \ |
| 47 | + make altinstall && \ |
| 48 | + cd / && \ |
| 49 | + rm -rf Python-${PYTHON_VERSION}* \ |
| 50 | + ; done |
24 | 51 |
|
25 | | -# Download python 3.8.11 |
26 | | -RUN wget https://www.python.org/ftp/python/3.8.11/Python-3.8.11.tgz |
| 52 | +# Install pip for each python version |
| 53 | +# TODO(http://github.com/googleapis/gapic-generator-python/issues/2435): Remove `3.10` when the linked issue is resolved. |
| 54 | +RUN wget --no-check-certificate -O /tmp/get-pip.py 'https://bootstrap.pypa.io/get-pip.py' && \ |
| 55 | + for PYTHON_VERSION in 3.10 3.13; do \ |
| 56 | + python${PYTHON_VERSION} /tmp/get-pip.py; \ |
| 57 | + done && \ |
| 58 | + rm /tmp/get-pip.py |
27 | 59 |
|
28 | | -# Extract files |
29 | | -RUN tar -xvf Python-3.8.11.tgz |
30 | 60 |
|
31 | | -# Install python 3.8.11 |
32 | | -RUN ./Python-3.8.11/configure --enable-optimizations |
33 | | -RUN make altinstall |
| 61 | +WORKDIR / |
34 | 62 |
|
35 | 63 | ###################### Install synthtool's requirements. |
36 | 64 | COPY requirements.txt /synthtool/requirements.txt |
37 | | -RUN pip install --require-hashes -r /synthtool/requirements.txt |
| 65 | +RUN python3.10 -m pip install --require-hashes -r /synthtool/requirements.txt |
38 | 66 |
|
39 | 67 | # Put synthtool in the PYTHONPATH so owlbot.py scripts will find it. |
40 | 68 | ENV PYTHONPATH="/synthtool" |
|
0 commit comments