-
Notifications
You must be signed in to change notification settings - Fork 233
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Allow users to install additional packages with a INSTALL_COMPONENTS …
…build-arg
- Loading branch information
1 parent
0358a55
commit c7e8279
Showing
2 changed files
with
26 additions
and
27 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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"] |