From 28ded999bf62562576c68a1b4d1856b02ab53b27 Mon Sep 17 00:00:00 2001 From: solomonope Date: Mon, 20 Apr 2020 14:28:56 +0200 Subject: [PATCH] chore(docker): add image that contains gcloud and aws --- .circleci/config.yml | 20 ++++++++++++++++++++ garden-service/aws.gcloud.Dockerfile | 22 ++++++++++++++++++++++ garden-service/bin/build-containers.sh | 6 ++++++ garden-service/bin/push-containers.sh | 1 + 4 files changed, 49 insertions(+) create mode 100644 garden-service/aws.gcloud.Dockerfile diff --git a/.circleci/config.yml b/.circleci/config.yml index fa7e538892..73f37ded01 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -344,6 +344,22 @@ jobs: cd garden-service docker build -t ${TAG} --build-arg TAG=${CIRCLE_SHA1} -f gcloud.Dockerfile . docker push ${TAG} + build-docker-aws-gcloud: + <<: *node-config + steps: + - setup_remote_docker: + docker_layer_caching: true + - checkout + - *attach-workspace + - run: + name: Build image and push to registry + command: | + docker login -u $DOCKER_USER -p $DOCKER_PASS + TAG=gardendev/garden-aws-gcloud:${CIRCLE_SHA1} + cd garden-service + docker build -t ${TAG} --build-arg TAG=${CIRCLE_SHA1} -f aws.gcloud.Dockerfile . + docker push ${TAG} + build-docker-buster: <<: *node-config steps: @@ -662,6 +678,10 @@ workflows: <<: *only-internal-prs context: docker requires: [build-docker] + - build-docker-aws-gcloud: + <<: *only-internal-prs + context: docker + requires: [build-docker] - build-docker-buster: <<: *only-internal-prs context: docker diff --git a/garden-service/aws.gcloud.Dockerfile b/garden-service/aws.gcloud.Dockerfile new file mode 100644 index 0000000000..25631c6ade --- /dev/null +++ b/garden-service/aws.gcloud.Dockerfile @@ -0,0 +1,22 @@ +ARG TAG=latest +FROM google/cloud-sdk:277.0.0-alpine as gcloud + +RUN gcloud components install kubectl + +FROM gardendev/garden:${TAG} + +ENV CLOUDSDK_PYTHON=python3 + +COPY --from=gcloud /google-cloud-sdk /google-cloud-sdk + +RUN apk add --no-cache python3 \ + && ln -s /google-cloud-sdk/bin/* /usr/local/bin/ \ + && chmod +x /usr/local/bin/* + +RUN apk add --no-cache python py-pip \ + && pip install awscli==1.17.9 --upgrade \ + && apk del py-pip + +RUN curl -o aws-iam-authenticator https://amazon-eks.s3.us-west-2.amazonaws.com/1.15.10/2020-02-22/bin/linux/amd64/aws-iam-authenticator \ + && chmod +x ./aws-iam-authenticator \ + && mv ./aws-iam-authenticator /usr/bin/ \ No newline at end of file diff --git a/garden-service/bin/build-containers.sh b/garden-service/bin/build-containers.sh index 0b213fc45c..9bc41f664a 100755 --- a/garden-service/bin/build-containers.sh +++ b/garden-service/bin/build-containers.sh @@ -10,6 +10,7 @@ version=${args[0]:-$(git rev-parse --short HEAD)} base_tag=gardendev/garden:${version} aws_tag=gardendev/garden-aws:${version} gcloud_tag=gardendev/garden-gcloud:${version} +aws_gcloud_tag=gardendev/garden-aws-gcloud:${version} buster_tag=gardendev/garden:${version}-buster echo "Building version ${version}" @@ -30,6 +31,11 @@ docker build -t ${gcloud_tag} --build-arg TAG=${version} -f gcloud.Dockerfile . echo "-> Check ${gcloud_tag}" docker run --rm -it ${gcloud_tag} version +echo "-> Build ${aws_gcloud_tag}" +docker build -t ${aws_gcloud_tag} --build-arg TAG=${version} -f aws.gcloud.Dockerfile . +echo "-> Check ${aws_gcloud_tag}" +docker run --rm -it ${aws_gcloud_tag} version + echo "-> Build ${buster_tag}" docker build -t ${buster_tag} -f buster.Dockerfile dist/linux-amd64 echo "-> Check ${buster_tag}" diff --git a/garden-service/bin/push-containers.sh b/garden-service/bin/push-containers.sh index b5e10d0342..ae0a0c8e1c 100755 --- a/garden-service/bin/push-containers.sh +++ b/garden-service/bin/push-containers.sh @@ -14,4 +14,5 @@ echo "Pushing images" docker push gardendev/garden:${version} docker push gardendev/garden-aws:${version} docker push gardendev/garden-gcloud:${version} +docker push gardendev/garden-aws-gcloud:${version} docker push gardendev/garden:${version}-buster