Skip to content

Instantly share code, notes, and snippets.

@rwcitek
Last active March 16, 2025 12:56
Show Gist options
  • Save rwcitek/b3dbb57c56d3d450bdef374f643604d5 to your computer and use it in GitHub Desktop.
Save rwcitek/b3dbb57c56d3d450bdef374f643604d5 to your computer and use it in GitHub Desktop.
Build dsub Docker image
temp=$(date +%s)
cat <<'eof' > Dockerfile.${temp}
FROM ubuntu:24.04
ARG DEBIAN_FRONTEND=noninteractive
SHELL ["/bin/bash", "-c"]
# install the basics
RUN apt-get update && \
apt-get install -y --no-install-recommends \
apt-transport-https \
apt-utils \
ca-certificates \
curl \
gnupg \
jq \
less \
python3-pip \
software-properties-common \
tree \
vim \
;
# install Google-SDK
RUN echo "deb [signed-by=/usr/share/keyrings/cloud.google.gpg] https://packages.cloud.google.com/apt cloud-sdk main" | \
tee -a /etc/apt/sources.list.d/google-cloud-sdk.list
RUN curl -s https://packages.cloud.google.com/apt/doc/apt-key.gpg | \
apt-key --keyring /usr/share/keyrings/cloud.google.gpg add -
RUN apt-get update && \
apt-get install -y --no-install-recommends \
google-cloud-cli
# install dsub
RUN pip install --no-cache-dir --break-system-packages dsub
# install docker
RUN curl -fsSL https://download.docker.com/linux/$( lsb_release -is | tr A-Z a-z )/gpg | \
gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg
RUN echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://download.docker.com/linux/$( lsb_release -is | tr A-Z a-z ) $(lsb_release -cs) stable" > /etc/apt/sources.list.d/docker.list
RUN apt-get update && \
apt-get install -y --no-install-recommends \
docker-ce
WORKDIR /tmp
CMD ["/bin/bash"]
eof
echo "COPY Dockerfile.${temp} /Dockerfile" >> Dockerfile.${temp}
docker build -t dsub:build-latest -f Dockerfile.${temp} .
rm Dockerfile.${temp}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment