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+ FROM marketplace.gcr.io/google/ubuntu2404 AS builder
16+
17+ # TODO(https://github.com/googleapis/librarian/issues/901): Install the necssary dependencies and build tools.
18+ RUN apt-get update && \
19+ apt-get install -y --no-install-recommends \
20+ # Essential for compiling C code
21+ build-essential \
22+ # For downloading secure files
23+ wget \
24+ ca-certificates \
25+ # --- Critical libraries for a complete Python build ---
26+ libssl-dev \
27+ zlib1g-dev \
28+ libbz2-dev \
29+ libffi-dev \
30+ libsqlite3-dev \
31+ libreadline-dev \
32+ # ------------------------------------------------------
33+ && apt-get clean && \
34+ rm -rf /var/lib/apt/lists/*
35+
36+ # Set up environment variables for tool versions to make updates easier.
37+ # TODO(): Downgrade to Python `3.11` if `3.13.5` is incompatible with googleapis.
38+ ENV PYTHON_VERSION=3.13.5
39+
40+ # Create a symbolic link for `python3` to point to our specific version.
41+ ENV PATH /usr/local/bin/python3.13:$PATH
42+
43+ # Install Python from source
44+ RUN wget https://www.python.org/ftp/python/${PYTHON_VERSION}/Python-${PYTHON_VERSION}.tgz && \
45+ tar -xvf Python-${PYTHON_VERSION}.tgz && \
46+ cd Python-${PYTHON_VERSION} && \
47+ ./configure --enable-optimizations && \
48+ make altinstall && \
49+ cd / && \
50+ rm -rf Python-${PYTHON_VERSION}*
51+
52+ # TODO(https://github.com/googleapis/librarian/issues/904): Install protoc for gencode.
53+
54+ # TODO(https://github.com/googleapis/librarian/issues/903): Install Bazelisk for building a client library.
55+
56+ # TODO(https://github.com/googleapis/librarian/issues/902): Create a dedicate non-root user and
57+ # switch to the non-root user to run subsequent commands.
58+
59+ # Set the working directory in the container.
60+ WORKDIR /app
61+
62+ # TODO(https://github.com/googleapis/librarian/issues/907): Install Python dependencies from requirements.in.
63+ # TODO(https://github.com/googleapis/librarian/issues/905): Install Synthtool by cloning its repo.
64+ # TODO(https://github.com/googleapis/librarian/issues/906): Clone googleapis and run bazelisk build.
65+
66+ # Copy the CLI script into the container and set ownership.
67+ # No other files or dependencies are needed for this simple script.
68+ COPY cli.py .
69+
70+ # Set the entrypoint for the container to run the script.
71+ ENTRYPOINT ["python3.13" , "./cli.py" ]
0 commit comments