Skip to content

Commit

Permalink
build: fix docs build (#12881)
Browse files Browse the repository at this point in the history
In PR #12634,
`.kokoro/docker/docs/Dockerfile` was updated to use `ubuntu:24.04`. The
previous version `ubuntu:22.04` had Python 3.10 installed by default. In
`ubuntu:24.04`, Python 3.12 is the default version. We need to restore
`Python 3.10` which is used in both the `docs` and `docfx` nox sessions.


https://github.com/googleapis/google-cloud-python/blob/81f6e2b4837e7174b2c7a8866ebba53eba25a3c7/packages/google-cloud-access-approval/noxfile.py#L36


https://github.com/googleapis/google-cloud-python/blob/81f6e2b4837e7174b2c7a8866ebba53eba25a3c7/packages/google-cloud-access-approval/noxfile.py#L290-L291


https://github.com/googleapis/google-cloud-python/blob/81f6e2b4837e7174b2c7a8866ebba53eba25a3c7/packages/google-cloud-access-approval/noxfile.py#L325-L326


I tested that this builds successfully by running `docker build -t
test_docs_mono_repo .` in the directory `kokoro/docker/docs`


I then ran the nox sessions `docs` and `docfx`.

Use this command to run the docker container and enter into bash

```
docker run --rm -it --entrypoint /bin/bash test_docs_mono_repo
```

Then in the docker container, run the following commands
```
git clone https://github.com/googleapis/google-cloud-python.git
cd google-cloud-python/packages/google-cloud-access-approval
nox -s docs
nox -s docfx
```
  • Loading branch information
parthea authored Jul 8, 2024
1 parent 81f6e2b commit 5834030
Showing 1 changed file with 11 additions and 9 deletions.
20 changes: 11 additions & 9 deletions .kokoro/docker/docs/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@ RUN apt-get update \
libssl-dev \
libsqlite3-dev \
portaudio19-dev \
python3-distutils \
redis-server \
software-properties-common \
ssh \
Expand All @@ -60,24 +59,27 @@ RUN apt-get update \
&& rm -rf /var/lib/apt/lists/* \
&& rm -f /var/cache/apt/archives/*.deb

###################### Install python 3.9.13
###################### Install python 3.10.14 for docs/docfx session

# Download python 3.9.13
RUN wget https://www.python.org/ftp/python/3.9.13/Python-3.9.13.tgz
# Download python 3.10.14
RUN wget https://www.python.org/ftp/python/3.10.14/Python-3.10.14.tgz

# Extract files
RUN tar -xvf Python-3.9.13.tgz
RUN tar -xvf Python-3.10.14.tgz

# Install python 3.9.13
RUN ./Python-3.9.13/configure --enable-optimizations
# Install python 3.10.14
RUN ./Python-3.10.14/configure --enable-optimizations
RUN make altinstall

RUN python3.10 -m venv /venv
ENV PATH /venv/bin:$PATH

###################### Install pip
RUN wget -O /tmp/get-pip.py 'https://bootstrap.pypa.io/get-pip.py' \
&& python3 /tmp/get-pip.py \
&& rm /tmp/get-pip.py

# Test pip
RUN python3.9 -m pip
RUN python3.10 -m pip

CMD ["python3.9"]
CMD ["python3.10"]

0 comments on commit 5834030

Please sign in to comment.