Skip to content

Commit

Permalink
Allow users to install additional packages with a INSTALL_COMPONENTS …
Browse files Browse the repository at this point in the history
…build-arg
  • Loading branch information
anindyatahsin committed Jun 12, 2024
1 parent 0358a55 commit c7e8279
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 27 deletions.
2 changes: 1 addition & 1 deletion generate_cloudbuild.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@
'default': '',
'debian_component_based': 'debian_component_based',
'emulators': 'emulators',
'stable': 'stable-beta' # change it to stable when the image is ready to release.
'stable': 'stable-alpha' # change it to stable when the image is ready to release.
}

def MakeGcrTags(label_without_tag,
Expand Down
51 changes: 25 additions & 26 deletions stable/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,40 +1,39 @@
FROM docker:26.1.3 as static-docker-source

FROM marketplace.gcr.io/google/debian12:latest as build_image

ARG CLOUD_SDK_VERSION
ENV CLOUD_SDK_VERSION=$CLOUD_SDK_VERSION
COPY --from=static-docker-source /usr/local/bin/docker /usr/local/bin/docker
COPY --from=static-docker-source /usr/local/libexec/docker/cli-plugins/docker-buildx /usr/local/libexec/docker/cli-plugins/docker-buildx
RUN groupadd -r -g 1000 cloudsdk && \
useradd -r -u 1000 -m -s /bin/bash -g cloudsdk cloudsdk
RUN apt-get update -qqy && apt-get -qqy upgrade && apt-get install -qqy \
ARG INSTALL_COMPONENTS

RUN apt-get update -qqy && apt-get -qqy upgrade && \
apt-get install -qqy \
curl \
python3-dev \
python3-crcmod \
apt-transport-https \
ca-certificates \
lsb-release \
openssh-client \
git \
make \
gnupg && \
export CLOUD_SDK_REPO="cloud-sdk-$(lsb_release -c -s)" && \
echo "deb https://packages.cloud.google.com/apt $CLOUD_SDK_REPO main" > /etc/apt/sources.list.d/google-cloud-sdk.list && \
curl https://packages.cloud.google.com/apt/doc/apt-key.gpg | apt-key add - && \
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 && \
curl https://packages.cloud.google.com/apt/doc/apt-key.gpg | gpg --dearmor -o /usr/share/keyrings/cloud.google.gpg && \
apt-get update && \
apt-get install -y google-cloud-cli=${CLOUD_SDK_VERSION}-0 &&\
gcloud --version && \
docker --version && rm -rf /root/.cache/pip/ && \
apt-get install -y google-cloud-cli=${CLOUD_SDK_VERSION}-0 $INSTALL_COMPONENTS &&\
rm -rf /root/.cache/pip/ && \
find / -name '*.pyc' -delete && \
find / -name '*__pycache__*' -delete
RUN apt-get install -qqy \
gcc \
python3-pip
RUN git config --system credential.'https://source.developers.google.com'.helper gcloud.sh
VOLUME ["/root/.config"]

FROM marketplace.gcr.io/google/debian12:latest as runtime_image
COPY --from=build_image /usr/lib/google-cloud-sdk /usr/lib/google-cloud-sdk
COPY --from=build_image /root/.config /root/.config

ENV PATH=$PATH:/usr/lib/google-cloud-sdk/bin

# Create a non-root user
RUN groupadd -r -g 1000 cloudsdk && \
useradd -r -u 1000 -m -s /bin/bash -g cloudsdk cloudsdk
RUN if [ `uname -m` = 'x86_64' ]; then echo -n "x86_64" > /tmp/arch; else echo -n "arm" > /tmp/arch && \
apt-get update -qqy && apt-get -qqy upgrade && apt-get install -qqy \
python3-dev \
python3-crcmod; fi;
RUN gcloud --version && \
gcloud config set core/disable_usage_reporting true && \
gcloud config set component_manager/disable_update_check true && \
gcloud config set metrics/environment github_docker_image && \
rm -rf /root/.cache/pip/ && \
find / -name '*.pyc' -delete && \
find / -name '*__pycache__*' -delete
VOLUME ["/root/.config"]

0 comments on commit c7e8279

Please sign in to comment.