|
12 | 12 | # See the License for the specific language governing permissions and |
13 | 13 | # limitations under the License. |
14 | 14 |
|
15 | | -FROM golang:bullseye |
| 15 | +FROM golang:1.26.1-trixie |
16 | 16 |
|
17 | 17 | ENV GOCACHE=/ghpc_go_cache |
18 | 18 |
|
19 | 19 | # copy the source code, to build the binary |
20 | 20 | # use `/workspace` to match path in cache for future builds |
21 | 21 | COPY ./ /workspace |
22 | 22 |
|
23 | | -RUN curl -fsSL https://apt.releases.hashicorp.com/gpg | apt-key add - && \ |
24 | | - apt-get -y update && apt-get -y install \ |
25 | | - # `software-properties-common` providers `add-apt-repository` |
26 | | - software-properties-common \ |
| 23 | +RUN apt-get -y update && apt-get -y install \ |
| 24 | + gnupg \ |
27 | 25 | keychain \ |
28 | 26 | # `dnsutils` provides `dig` used by integration tests |
29 | 27 | dnsutils && \ |
30 | 28 | # install terraform and packer |
31 | | - apt-add-repository "deb [arch=$(dpkg --print-architecture)] https://apt.releases.hashicorp.com bullseye main" && \ |
| 29 | + curl -fsSL https://apt.releases.hashicorp.com/gpg | gpg --dearmor -o /usr/share/keyrings/hashicorp-archive-keyring.gpg && \ |
| 30 | + echo "deb [signed-by=/usr/share/keyrings/hashicorp-archive-keyring.gpg arch=$(dpkg --print-architecture)] https://apt.releases.hashicorp.com trixie main" | tee /etc/apt/sources.list.d/hashicorp.list && \ |
32 | 31 | apt-get -y update && \ |
33 | 32 | # Pin Terraform version to 1.12.2 |
34 | | - apt-get install -y unzip python3-pip python3-netaddr terraform=1.12.2-1 packer jq && \ |
| 33 | + apt-get install -y unzip python3-pip python3-venv terraform=1.12.2-1 packer jq && \ |
35 | 34 | # install gcloud |
| 35 | + curl https://packages.cloud.google.com/apt/doc/apt-key.gpg | gpg --dearmor -o /usr/share/keyrings/cloud.google.gpg && \ |
36 | 36 | echo "deb [signed-by=/usr/share/keyrings/cloud.google.gpg] https://packages.cloud.google.com/apt cloud-sdk main" \ |
37 | 37 | | tee -a /etc/apt/sources.list.d/google-cloud-sdk.list && \ |
38 | | - curl https://packages.cloud.google.com/apt/doc/apt-key.gpg \ |
39 | | - | apt-key --keyring /usr/share/keyrings/cloud.google.gpg add - && \ |
40 | 38 | apt-get -y update && apt-get -y install google-cloud-sdk && \ |
41 | 39 | apt-get -y install kubectl && \ |
42 | 40 | # following is required to execute kubectl commands |
43 | 41 | apt-get -y install google-cloud-cli-gke-gcloud-auth-plugin && \ |
44 | 42 | apt-get clean && rm -rf /var/lib/apt/lists/* && \ |
| 43 | + # create virtual environment |
| 44 | + python3 -m venv /opt/venv && \ |
45 | 45 | # install ansible and python dependencies |
46 | | - pip install --no-cache-dir --upgrade pip && \ |
47 | | - pip install --no-cache-dir -r https://raw.githubusercontent.com/GoogleCloudPlatform/slurm-gcp/master/scripts/requirements.txt && \ |
48 | | - pip install --no-cache-dir ansible && \ |
49 | | - pip install --no-cache-dir paramiko && \ |
| 46 | + /opt/venv/bin/pip install --no-cache-dir --upgrade pip && \ |
| 47 | + /opt/venv/bin/pip install --no-cache-dir -r https://raw.githubusercontent.com/GoogleCloudPlatform/slurm-gcp/master/scripts/requirements.txt && \ |
| 48 | + /opt/venv/bin/pip install --no-cache-dir ansible && \ |
| 49 | + /opt/venv/bin/pip install --no-cache-dir paramiko && \ |
| 50 | + /opt/venv/bin/pip install --no-cache-dir netaddr && \ |
50 | 51 | rm -rf ~/.cache/pip/* && \ |
51 | 52 | # compile the binary to warm up `/ghpc_go_cache` |
52 | 53 | cd /workspace && make gcluster && \ |
53 | 54 | # remove /workspace to reduce image size |
54 | 55 | rm -rf /workspace |
| 56 | + |
| 57 | +ENV PATH="/opt/venv/bin:$PATH" |
0 commit comments