JetBrains / teamcity-docker-agent

TeamCity agent docker image sources
https://hub.docker.com/r/jetbrains/teamcity-agent/
Apache License 2.0
77 stars 64 forks source link

Install Google Cloud SDK #15

Open lorddaedra opened 6 years ago

lorddaedra commented 6 years ago
    \
    echo "Installing Google Cloud SDK..." && \
    apt-get update && \
    apt-get install -y --no-install-recommends apt-transport-https && \
    export CLOUD_SDK_REPO="cloud-sdk-$(lsb_release -c -s)" && \
    echo "deb https://packages.cloud.google.com/apt $CLOUD_SDK_REPO main" | tee -a /etc/apt/sources.list.d/google-cloud-sdk.list && \
    curl https://packages.cloud.google.com/apt/doc/apt-key.gpg | sudo apt-key add - && \
    apt-get update && \
    apt-get install -y --no-install-recommends google-cloud-sdk && \
    rm -rf /var/lib/apt/lists/* && \
    gcloud config set core/disable_usage_reporting true && \
    gcloud config set component_manager/disable_update_check true && \
    \

Is will allow to use gsutil tools to sync local static folder with google cloud storage bucket (like s3 equivalent)

From: https://cloud.google.com/storage/docs/gsutil_install#deb

lorddaedra commented 6 years ago

@VladRassokhin

Hi, Vlad!

What do you think about it? it should be easy to maintain because of no version updates required, it will always install latest available version.

lorddaedra commented 6 years ago

Another solution - use docker in docker (but it require to use --privileged flag) or mount docker.sock inside Agent. Next use https://github.com/GoogleCloudPlatform/cloud-sdk-docker/blob/master/Dockerfile (https://hub.docker.com/r/google/cloud-sdk/), but this solution can't be the best for security reasons...

VladRassokhin commented 6 years ago

I'm trying to keep agent image as tiny as possible (but failing sometimes) Tried your snippet with on teamcity-agent, got next size results

docker history gcloud-agent
IMAGE               CREATED             CREATED BY                                      SIZE                COMMENT
ee7e6fab578a        4 seconds ago       /bin/sh -c echo "Installing Google Cloud S...   164MB "Add gloud"
5ae0b299f785        12 days ago         /bin/sh -c #(nop) COPY file:fa3ff1c6bbbc42...   111B  "Last in teamcity-agent:latest"

I'd say adding 164Mb is quite too expensive. I'd suggest to use docker-in-docker approach or building new image on top of jetbrains/teamcity-agent