Skip to content

Commit 1a93c8e

Browse files
authored
Merge pull request #4379 from vikramvs-gg/workstation_image
Changes to Dockerfile for updating workstation image
2 parents 0108225 + 2d428cc commit 1a93c8e

1 file changed

Lines changed: 47 additions & 22 deletions

File tree

tools/cloud-workstations/Dockerfile

Lines changed: 47 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -16,39 +16,54 @@
1616
FROM us-central1-docker.pkg.dev/cloud-workstations-images/predefined/code-oss:latest
1717

1818
ARG TFLINT_VERSION
19-
# Need to get shellcheck directly as the on the repo is outdated and causes failures
2019
ARG SHELLCHECK_VER=v0.9.0
2120

22-
RUN curl -fsSL https://apt.releases.hashicorp.com/gpg | apt-key add - && \
23-
apt-get -y update && apt-get -y install \
21+
# --- Install Base Utilities and Tools ---
22+
RUN apt-get -y update && apt-get -y install \
2423
software-properties-common \
2524
keychain \
26-
dnsutils && \
27-
apt-add-repository "deb [arch=$(dpkg --print-architecture)] https://apt.releases.hashicorp.com bullseye main" && \
28-
apt-get -y update && apt-get install -y unzip python3-pip python3-venv terraform packer jq tmux && \
29-
echo "deb [signed-by=/usr/share/keyrings/cloud.google.gpg] https://packages.cloud.google.com/apt cloud-sdk main" \
30-
| tee -a /etc/apt/sources.list.d/google-cloud-sdk.list && \
31-
curl https://packages.cloud.google.com/apt/doc/apt-key.gpg \
32-
| apt-key --keyring /usr/share/keyrings/cloud.google.gpg add - && \
33-
apt-get -y update && apt-get -y install google-cloud-sdk && \
25+
dnsutils \
26+
curl \
27+
gnupg \
28+
lsb-release \
29+
unzip \
30+
jq \
31+
tmux && \
3432
apt-get clean && rm -rf /var/lib/apt/lists/*
3533

36-
RUN wget https://github.com/koalaman/shellcheck/releases/download/v0.9.0/shellcheck-$SHELLCHECK_VER.linux.x86_64.tar.xz && \
37-
tar xvf shellcheck-$SHELLCHECK_VER.linux.x86_64.tar.xz && \
38-
mv shellcheck-$SHELLCHECK_VER/shellcheck /bin/shellcheck
34+
# --- Install ShellCheck ---
35+
RUN wget https://github.com/koalaman/shellcheck/releases/download/${SHELLCHECK_VER}/shellcheck-${SHELLCHECK_VER}.linux.x86_64.tar.xz && \
36+
tar xvf shellcheck-${SHELLCHECK_VER}.linux.x86_64.tar.xz && \
37+
mv shellcheck-${SHELLCHECK_VER}/shellcheck /usr/local/bin/shellcheck && \
38+
rm -rf shellcheck-*
3939

40+
# --- Install TFLint ---
4041
RUN curl -s https://raw.githubusercontent.com/terraform-linters/tflint/master/install_linux.sh | bash
4142

42-
COPY tools/cloud-build/requirements.txt cloud_build_requirements.txt
43-
COPY docs/hybrid-slurm-cluster/requirements.txt slurm_requirements.txt
43+
# --- Add HashiCorp Repo and Install Terraform/Packer ---
44+
RUN curl -fsSL https://apt.releases.hashicorp.com/gpg | gpg --dearmor -o /usr/share/keyrings/hashicorp-archive-keyring.gpg && \
45+
echo "deb [signed-by=/usr/share/keyrings/hashicorp-archive-keyring.gpg arch=$(dpkg --print-architecture)] https://apt.releases.hashicorp.com $(lsb_release -cs) main" | tee /etc/apt/sources.list.d/hashicorp.list && \
46+
apt-get -y update && apt-get install -y \
47+
terraform \
48+
packer && \
49+
apt-get clean && rm -rf /var/lib/apt/lists/*
4450

45-
RUN pip install --no-cache-dir --upgrade pip && \
46-
pip install --no-cache-dir -r https://raw.githubusercontent.com/SchedMD/slurm-gcp/master/scripts/requirements.txt && \
47-
pip install --no-cache-dir -r cloud_build_requirements.txt && \
48-
pip install --no-cache-dir -r slurm_requirements.txt && \
49-
rm -rf ~/.cache/pip/*
51+
# --- Install Python and Set as Default ---
52+
RUN add-apt-repository ppa:deadsnakes/ppa && \
53+
apt-get -y update && \
54+
apt-get -y install \
55+
python3.10 \
56+
python3.10-venv \
57+
python3.10-dev \
58+
python3-pip && \
59+
update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.10 1 && \
60+
apt-get clean && rm -rf /var/lib/apt/lists/*
61+
62+
# --- Create Virtual Environment ---
63+
RUN python3 -m venv /opt/venv
64+
ENV PATH="/opt/venv/bin:$PATH"
5065

51-
# Get the HPC config files and store them in the correct locations for startup
66+
# --- Copy configuration files ---
5267
ARG CW_DIR=tools/cloud-workstations
5368
ARG HPC_WORK_FILE=200_configure-hpc-toolkit.sh
5469
ARG HPC_CONF_FILE=configure-hpc-toolkit.sh
@@ -65,3 +80,13 @@ RUN chmod a+rx $START_DIR/$HPC_WORK_FILE
6580

6681
COPY $CW_DIR/$CODE_REQS $HPC_CONFIG_DIR/$CODE_REQS
6782
RUN chmod a+r $HPC_CONFIG_DIR/$CODE_REQS
83+
84+
COPY tools/cloud-build/requirements.txt cloud_build_requirements.txt
85+
COPY docs/hybrid-slurm-cluster/requirements.txt slurm_requirements.txt
86+
87+
# --- Install Python Dependencies ---
88+
RUN pip install --no-cache-dir --upgrade pip setuptools wheel && \
89+
pip install --no-cache-dir --prefer-binary --no-build-isolation -r https://raw.githubusercontent.com/SchedMD/slurm-gcp/master/scripts/requirements.txt && \
90+
pip install --no-cache-dir --prefer-binary --no-build-isolation -r cloud_build_requirements.txt && \
91+
pip install --no-cache-dir --prefer-binary --no-build-isolation -r slurm_requirements.txt && \
92+
rm -rf ~/.cache/pip/*

0 commit comments

Comments
 (0)