diff --git a/cloudbuild.yaml b/cloudbuild.yaml index c6e68fc3..fff2ae67 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-alpha', '-t', 'google/cloud-sdk:$TAG_NAME-stable-alpha', '-t', 'us-docker.pkg.dev/google.com/cloudsdktool/gcr.io/cloud-sdk:stable-alpha', '-t', 'us-docker.pkg.dev/google.com/cloudsdktool/gcr.io/cloud-sdk:$TAG_NAME-stable-alpha', '-t', 'us-docker.pkg.dev/google.com/cloudsdktool/gcr.io/google-cloud-cli:stable-alpha', '-t', 'us-docker.pkg.dev/google.com/cloudsdktool/gcr.io/google-cloud-cli:$TAG_NAME-stable-alpha', '-t', 'us-docker.pkg.dev/google.com/cloudsdktool/us.gcr.io/cloud-sdk:stable-alpha', '-t', 'us-docker.pkg.dev/google.com/cloudsdktool/us.gcr.io/cloud-sdk:$TAG_NAME-stable-alpha', '-t', 'us-docker.pkg.dev/google.com/cloudsdktool/us.gcr.io/google-cloud-cli:stable-alpha', '-t', 'us-docker.pkg.dev/google.com/cloudsdktool/us.gcr.io/google-cloud-cli:$TAG_NAME-stable-alpha', '-t', 'europe-docker.pkg.dev/google.com/cloudsdktool/eu.gcr.io/cloud-sdk:stable-alpha', '-t', 'europe-docker.pkg.dev/google.com/cloudsdktool/eu.gcr.io/cloud-sdk:$TAG_NAME-stable-alpha', '-t', 'europe-docker.pkg.dev/google.com/cloudsdktool/eu.gcr.io/google-cloud-cli:stable-alpha', '-t', 'europe-docker.pkg.dev/google.com/cloudsdktool/eu.gcr.io/google-cloud-cli:$TAG_NAME-stable-alpha', '-t', 'asia-docker.pkg.dev/google.com/cloudsdktool/asia.gcr.io/cloud-sdk:stable-alpha', '-t', 'asia-docker.pkg.dev/google.com/cloudsdktool/asia.gcr.io/cloud-sdk:$TAG_NAME-stable-alpha', '-t', 'asia-docker.pkg.dev/google.com/cloudsdktool/asia.gcr.io/google-cloud-cli:stable-alpha', '-t', 'asia-docker.pkg.dev/google.com/cloudsdktool/asia.gcr.io/google-cloud-cli:$TAG_NAME-stable-alpha', '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-alpha'] + waitFor: ['dockersecret', 'stable'] +- name: 'gcr.io/cloud-builders/docker' + args: ['push', 'google/cloud-sdk:$TAG_NAME-stable-alpha'] + 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-alpha' - '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-alpha' - '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-alpha' - '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-alpha' - '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-alpha' - '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-alpha' - '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-alpha' - '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-alpha' - '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-alpha' - '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-alpha' - '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-alpha' - '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-alpha' - '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-alpha' - '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-alpha' - '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-alpha' - '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-alpha' 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..4f597f6d 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-alpha' # change it to stable when the image is ready to release. } def MakeGcrTags(label_without_tag, diff --git a/stable/Dockerfile b/stable/Dockerfile new file mode 100644 index 00000000..000debe1 --- /dev/null +++ b/stable/Dockerfile @@ -0,0 +1,38 @@ +FROM marketplace.gcr.io/google/debian12:latest as build_image + +ARG CLOUD_SDK_VERSION +ENV CLOUD_SDK_VERSION=$CLOUD_SDK_VERSION +ARG INSTALL_COMPONENTS + +RUN apt-get update -qqy && apt-get -qqy upgrade && \ + apt-get install -qqy \ + curl \ + ca-certificates \ + lsb-release \ + gnupg && \ + export CLOUD_SDK_REPO="cloud-sdk-$(lsb_release -c -s)" && \ + 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 $INSTALL_COMPONENTS &&\ + rm -rf /root/.cache/pip/ && \ + find / -name '*.pyc' -delete && \ + find / -name '*__pycache__*' -delete +FROM marketplace.gcr.io/google/debian12:latest as runtime_image +COPY --from=build_image /usr/lib/google-cloud-sdk /usr/lib/google-cloud-sdk + +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 false && \ + gcloud config set component_manager/disable_update_check true && \ + rm -rf /root/.cache/pip/ && \ + find / -name '*.pyc' -delete && \ + find / -name '*__pycache__*' -delete +VOLUME ["/root/.config"]