diff --git a/cloudbuild.yaml b/cloudbuild.yaml index c6e68fc3..0dc47b77 100644 --- a/cloudbuild.yaml +++ b/cloudbuild.yaml @@ -51,6 +51,10 @@ steps: id: emulators args: ['build', '--build-arg', 'CLOUD_SDK_VERSION=$_CLI_VERSION', '-t', 'google/cloud-sdk:emulators', '-t', 'google/cloud-sdk:$TAG_NAME-emulators', '-t', 'us-docker.pkg.dev/google.com/cloudsdktool/gcr.io/cloud-sdk:emulators', '-t', 'us-docker.pkg.dev/google.com/cloudsdktool/gcr.io/cloud-sdk:$TAG_NAME-emulators', '-t', 'us-docker.pkg.dev/google.com/cloudsdktool/us.gcr.io/cloud-sdk:emulators', '-t', 'us-docker.pkg.dev/google.com/cloudsdktool/us.gcr.io/cloud-sdk:$TAG_NAME-emulators', '-t', 'europe-docker.pkg.dev/google.com/cloudsdktool/eu.gcr.io/cloud-sdk:emulators', '-t', 'europe-docker.pkg.dev/google.com/cloudsdktool/eu.gcr.io/cloud-sdk:$TAG_NAME-emulators', '-t', 'asia-docker.pkg.dev/google.com/cloudsdktool/asia.gcr.io/cloud-sdk:emulators', '-t', 'asia-docker.pkg.dev/google.com/cloudsdktool/asia.gcr.io/cloud-sdk:$TAG_NAME-emulators', 'emulators/'] waitFor: ['-'] +- name: 'gcr.io/cloud-builders/docker' + id: stable + args: ['build', '--build-arg', 'CLOUD_SDK_VERSION=$_CLI_VERSION', '-t', 'google/cloud-sdk:stable', '-t', 'google/cloud-sdk:$TAG_NAME-stable', '-t', 'us-docker.pkg.dev/google.com/cloudsdktool/gcr.io/cloud-sdk:stable', '-t', 'us-docker.pkg.dev/google.com/cloudsdktool/gcr.io/cloud-sdk:$TAG_NAME-stable', '-t', 'us-docker.pkg.dev/google.com/cloudsdktool/gcr.io/google-cloud-cli:stable', '-t', 'us-docker.pkg.dev/google.com/cloudsdktool/gcr.io/google-cloud-cli:$TAG_NAME-stable', '-t', 'us-docker.pkg.dev/google.com/cloudsdktool/us.gcr.io/cloud-sdk:stable', '-t', 'us-docker.pkg.dev/google.com/cloudsdktool/us.gcr.io/cloud-sdk:$TAG_NAME-stable', '-t', 'us-docker.pkg.dev/google.com/cloudsdktool/us.gcr.io/google-cloud-cli:stable', '-t', 'us-docker.pkg.dev/google.com/cloudsdktool/us.gcr.io/google-cloud-cli:$TAG_NAME-stable', '-t', 'europe-docker.pkg.dev/google.com/cloudsdktool/eu.gcr.io/cloud-sdk:stable', '-t', 'europe-docker.pkg.dev/google.com/cloudsdktool/eu.gcr.io/cloud-sdk:$TAG_NAME-stable', '-t', 'europe-docker.pkg.dev/google.com/cloudsdktool/eu.gcr.io/google-cloud-cli:stable', '-t', 'europe-docker.pkg.dev/google.com/cloudsdktool/eu.gcr.io/google-cloud-cli:$TAG_NAME-stable', '-t', 'asia-docker.pkg.dev/google.com/cloudsdktool/asia.gcr.io/cloud-sdk:stable', '-t', 'asia-docker.pkg.dev/google.com/cloudsdktool/asia.gcr.io/cloud-sdk:$TAG_NAME-stable', '-t', 'asia-docker.pkg.dev/google.com/cloudsdktool/asia.gcr.io/google-cloud-cli:stable', '-t', 'asia-docker.pkg.dev/google.com/cloudsdktool/asia.gcr.io/google-cloud-cli:$TAG_NAME-stable', 'stable/'] + waitFor: ['-'] # END OF PROD BUILDING STEPS - name: 'gcr.io/cloud-builders/docker' id: multi_arch_debian_slim @@ -103,55 +107,77 @@ steps: - name: 'gcr.io/cloud-builders/docker' args: ['push', 'google/cloud-sdk:$TAG_NAME-emulators'] waitFor: ['dockersecret', 'emulators'] +- name: 'gcr.io/cloud-builders/docker' + args: ['push', 'google/cloud-sdk:stable'] + waitFor: ['dockersecret', 'stable'] +- name: 'gcr.io/cloud-builders/docker' + args: ['push', 'google/cloud-sdk:$TAG_NAME-stable'] + waitFor: ['dockersecret', 'stable'] images: - 'asia-docker.pkg.dev/google.com/cloudsdktool/asia.gcr.io/cloud-sdk:$TAG_NAME' - 'asia-docker.pkg.dev/google.com/cloudsdktool/asia.gcr.io/cloud-sdk:$TAG_NAME-alpine' - 'asia-docker.pkg.dev/google.com/cloudsdktool/asia.gcr.io/cloud-sdk:$TAG_NAME-debian_component_based' - 'asia-docker.pkg.dev/google.com/cloudsdktool/asia.gcr.io/cloud-sdk:$TAG_NAME-emulators' - 'asia-docker.pkg.dev/google.com/cloudsdktool/asia.gcr.io/cloud-sdk:$TAG_NAME-slim' +- 'asia-docker.pkg.dev/google.com/cloudsdktool/asia.gcr.io/cloud-sdk:$TAG_NAME-stable' - 'asia-docker.pkg.dev/google.com/cloudsdktool/asia.gcr.io/cloud-sdk:alpine' - 'asia-docker.pkg.dev/google.com/cloudsdktool/asia.gcr.io/cloud-sdk:debian_component_based' - 'asia-docker.pkg.dev/google.com/cloudsdktool/asia.gcr.io/cloud-sdk:emulators' - 'asia-docker.pkg.dev/google.com/cloudsdktool/asia.gcr.io/cloud-sdk:latest' - 'asia-docker.pkg.dev/google.com/cloudsdktool/asia.gcr.io/cloud-sdk:slim' +- 'asia-docker.pkg.dev/google.com/cloudsdktool/asia.gcr.io/cloud-sdk:stable' - 'asia-docker.pkg.dev/google.com/cloudsdktool/asia.gcr.io/google-cloud-cli:$TAG_NAME' +- 'asia-docker.pkg.dev/google.com/cloudsdktool/asia.gcr.io/google-cloud-cli:$TAG_NAME-stable' - 'asia-docker.pkg.dev/google.com/cloudsdktool/asia.gcr.io/google-cloud-cli:latest' +- 'asia-docker.pkg.dev/google.com/cloudsdktool/asia.gcr.io/google-cloud-cli:stable' - 'europe-docker.pkg.dev/google.com/cloudsdktool/eu.gcr.io/cloud-sdk:$TAG_NAME' - 'europe-docker.pkg.dev/google.com/cloudsdktool/eu.gcr.io/cloud-sdk:$TAG_NAME-alpine' - 'europe-docker.pkg.dev/google.com/cloudsdktool/eu.gcr.io/cloud-sdk:$TAG_NAME-debian_component_based' - 'europe-docker.pkg.dev/google.com/cloudsdktool/eu.gcr.io/cloud-sdk:$TAG_NAME-emulators' - 'europe-docker.pkg.dev/google.com/cloudsdktool/eu.gcr.io/cloud-sdk:$TAG_NAME-slim' +- 'europe-docker.pkg.dev/google.com/cloudsdktool/eu.gcr.io/cloud-sdk:$TAG_NAME-stable' - 'europe-docker.pkg.dev/google.com/cloudsdktool/eu.gcr.io/cloud-sdk:alpine' - 'europe-docker.pkg.dev/google.com/cloudsdktool/eu.gcr.io/cloud-sdk:debian_component_based' - 'europe-docker.pkg.dev/google.com/cloudsdktool/eu.gcr.io/cloud-sdk:emulators' - 'europe-docker.pkg.dev/google.com/cloudsdktool/eu.gcr.io/cloud-sdk:latest' - 'europe-docker.pkg.dev/google.com/cloudsdktool/eu.gcr.io/cloud-sdk:slim' +- 'europe-docker.pkg.dev/google.com/cloudsdktool/eu.gcr.io/cloud-sdk:stable' - 'europe-docker.pkg.dev/google.com/cloudsdktool/eu.gcr.io/google-cloud-cli:$TAG_NAME' +- 'europe-docker.pkg.dev/google.com/cloudsdktool/eu.gcr.io/google-cloud-cli:$TAG_NAME-stable' - 'europe-docker.pkg.dev/google.com/cloudsdktool/eu.gcr.io/google-cloud-cli:latest' +- 'europe-docker.pkg.dev/google.com/cloudsdktool/eu.gcr.io/google-cloud-cli:stable' - 'us-docker.pkg.dev/google.com/cloudsdktool/gcr.io/cloud-sdk:$TAG_NAME' - 'us-docker.pkg.dev/google.com/cloudsdktool/gcr.io/cloud-sdk:$TAG_NAME-alpine' - 'us-docker.pkg.dev/google.com/cloudsdktool/gcr.io/cloud-sdk:$TAG_NAME-debian_component_based' - 'us-docker.pkg.dev/google.com/cloudsdktool/gcr.io/cloud-sdk:$TAG_NAME-emulators' - 'us-docker.pkg.dev/google.com/cloudsdktool/gcr.io/cloud-sdk:$TAG_NAME-slim' +- 'us-docker.pkg.dev/google.com/cloudsdktool/gcr.io/cloud-sdk:$TAG_NAME-stable' - 'us-docker.pkg.dev/google.com/cloudsdktool/gcr.io/cloud-sdk:alpine' - 'us-docker.pkg.dev/google.com/cloudsdktool/gcr.io/cloud-sdk:debian_component_based' - 'us-docker.pkg.dev/google.com/cloudsdktool/gcr.io/cloud-sdk:emulators' - 'us-docker.pkg.dev/google.com/cloudsdktool/gcr.io/cloud-sdk:latest' - 'us-docker.pkg.dev/google.com/cloudsdktool/gcr.io/cloud-sdk:slim' +- 'us-docker.pkg.dev/google.com/cloudsdktool/gcr.io/cloud-sdk:stable' - 'us-docker.pkg.dev/google.com/cloudsdktool/gcr.io/google-cloud-cli:$TAG_NAME' +- 'us-docker.pkg.dev/google.com/cloudsdktool/gcr.io/google-cloud-cli:$TAG_NAME-stable' - 'us-docker.pkg.dev/google.com/cloudsdktool/gcr.io/google-cloud-cli:latest' +- 'us-docker.pkg.dev/google.com/cloudsdktool/gcr.io/google-cloud-cli:stable' - 'us-docker.pkg.dev/google.com/cloudsdktool/us.gcr.io/cloud-sdk:$TAG_NAME' - 'us-docker.pkg.dev/google.com/cloudsdktool/us.gcr.io/cloud-sdk:$TAG_NAME-alpine' - 'us-docker.pkg.dev/google.com/cloudsdktool/us.gcr.io/cloud-sdk:$TAG_NAME-debian_component_based' - 'us-docker.pkg.dev/google.com/cloudsdktool/us.gcr.io/cloud-sdk:$TAG_NAME-emulators' - 'us-docker.pkg.dev/google.com/cloudsdktool/us.gcr.io/cloud-sdk:$TAG_NAME-slim' +- 'us-docker.pkg.dev/google.com/cloudsdktool/us.gcr.io/cloud-sdk:$TAG_NAME-stable' - 'us-docker.pkg.dev/google.com/cloudsdktool/us.gcr.io/cloud-sdk:alpine' - 'us-docker.pkg.dev/google.com/cloudsdktool/us.gcr.io/cloud-sdk:debian_component_based' - 'us-docker.pkg.dev/google.com/cloudsdktool/us.gcr.io/cloud-sdk:emulators' - 'us-docker.pkg.dev/google.com/cloudsdktool/us.gcr.io/cloud-sdk:latest' - 'us-docker.pkg.dev/google.com/cloudsdktool/us.gcr.io/cloud-sdk:slim' +- 'us-docker.pkg.dev/google.com/cloudsdktool/us.gcr.io/cloud-sdk:stable' - 'us-docker.pkg.dev/google.com/cloudsdktool/us.gcr.io/google-cloud-cli:$TAG_NAME' +- 'us-docker.pkg.dev/google.com/cloudsdktool/us.gcr.io/google-cloud-cli:$TAG_NAME-stable' - 'us-docker.pkg.dev/google.com/cloudsdktool/us.gcr.io/google-cloud-cli:latest' +- 'us-docker.pkg.dev/google.com/cloudsdktool/us.gcr.io/google-cloud-cli:stable' secrets: - kmsKeyName: projects/google.com:cloudsdktool/locations/global/keyRings/docker/cryptoKeys/dockerhub-password secretEnv: diff --git a/generate_cloudbuild.py b/generate_cloudbuild.py index fd0136ed..a5b77fef 100644 --- a/generate_cloudbuild.py +++ b/generate_cloudbuild.py @@ -55,14 +55,15 @@ DOCKERHUB_PREFIX='google' OLD_NAME='cloud-sdk' REBRAND_NAME='google-cloud-cli' -IMAGES=['alpine', 'debian_slim', 'default', 'debian_component_based', 'emulators'] +IMAGES=['alpine', 'debian_slim', 'default', 'debian_component_based', 'emulators', 'stable'] MULTI_ARCH=['debian_slim', 'debian_component_based', 'alpine', 'emulators'] LABEL_FOR_IMAGE={ 'alpine': 'alpine', 'debian_slim': 'slim', 'default': '', 'debian_component_based': 'debian_component_based', - 'emulators': 'emulators' + 'emulators': 'emulators', + 'stable': 'stable' } def MakeGcrTags(label_without_tag, diff --git a/stable/Dockerfile b/stable/Dockerfile new file mode 100644 index 00000000..75a45467 --- /dev/null +++ b/stable/Dockerfile @@ -0,0 +1,40 @@ +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 \ + curl \ + python3-dev \ + python3-crcmod \ + apt-transport-https \ + 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 - && \ + apt-get update && \ + apt-get install -y google-cloud-cli=${CLOUD_SDK_VERSION}-0 &&\ + gcloud --version && \ + docker --version && 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 +