Skip to content

Commit

Permalink
feat(GCP): Adding google cli
Browse files Browse the repository at this point in the history
  • Loading branch information
hypery2k committed Dec 9, 2019
1 parent 29bdd4f commit d956090
Show file tree
Hide file tree
Showing 4 changed files with 44 additions and 15 deletions.
38 changes: 30 additions & 8 deletions .bin/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,33 @@

export IMAGE_TAG=${1:-latest}

(cd docker/_base && ansible-galaxy install -r roles/requirements.yml -f && packer build build.json)
(cd docker/ansible && ansible-galaxy install -r roles/requirements.yml -f && packer build build.json)
(cd docker/terraform && ansible-galaxy install -r roles/requirements.yml -f && packer build build.json)
(cd docker/java && ansible-galaxy install -r roles/requirements.yml -f && packer build openjdk8.json)
(cd docker/java && ansible-galaxy install -r roles/requirements.yml -f && packer build openjdk11.json)
(cd docker/java && ansible-galaxy install -r roles/requirements.yml -f && packer build oraclejdk12.json)
(cd docker/java && ansible-galaxy install -r roles/requirements.yml -f && packer build oraclejdk13.json)
(cd docker/nodejs && ansible-galaxy install -r roles/requirements.yml -f && packer build build.json)
function prepareImage {
(cd ${1} && ansible-galaxy install -r roles/requirements.yml -f)
}

function buildImage {
(cd ${1} && packer build $2)
}
# Setup
prepareImage "docker/_base"
prepareImage "docker/ansible"
prepareImage "docker/terraform"
prepareImage "docker/java"
prepareImage "docker/java"
prepareImage "docker/java"
prepareImage "docker/java"
prepareImage "docker/nodejs"

# build common base
buildImage "docker/_base" "build.json"

# build other images in parallel
buildImage "docker/ansible" "build.json" &
buildImage "docker/terraform" "build.json" &
buildImage "docker/java" "openjdk8.json" &
buildImage "docker/java" "openjdk11.json" &
buildImage "docker/java" "oraclejdk12.json" &
buildImage "docker/java" "oraclejdk13.json" &
buildImage "docker/nodejs" "build.json" &
# wait for completion
wait
18 changes: 11 additions & 7 deletions .bin/deploy.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,14 @@

export IMAGE_TAG=${1:-latest}

docker push toolisticon/ansible-builder:${IMAGE_TAG}
docker push toolisticon/terraform-builder:${IMAGE_TAG}
docker push toolisticon/nodejs-builder:${IMAGE_TAG}
docker push toolisticon/openjdk8-builder:${IMAGE_TAG}
docker push toolisticon/openjdk11-builder:${IMAGE_TAG}
docker push toolisticon/oraclejdk12-builder:${IMAGE_TAG}
docker push toolisticon/oraclejdk13-builder:${IMAGE_TAG}

# deploy images in parallel
docker push toolisticon/ansible-builder:${IMAGE_TAG} &
docker push toolisticon/terraform-builder:${IMAGE_TAG} &
docker push toolisticon/nodejs-builder:${IMAGE_TAG} &
docker push toolisticon/openjdk8-builder:${IMAGE_TAG} &
docker push toolisticon/openjdk11-builder:${IMAGE_TAG} &
docker push toolisticon/oraclejdk12-builder:${IMAGE_TAG} &
docker push toolisticon/oraclejdk13-builder:${IMAGE_TAG} &
# wait for completion
wait
2 changes: 2 additions & 0 deletions roles/prepare/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,5 @@

- name: Boostrap kubectl
raw: curl -LO https://storage.googleapis.com/kubernetes-release/release/$(curl -s https://storage.googleapis.com/kubernetes-release/release/stable.txt)/bin/linux/amd64/kubectl && chmod +x ./kubectl && mv ./kubectl /usr/local/bin/kubectl
- name: GCloud CLI
raw: echo "deb [signed-by=/usr/share/keyrings/cloud.google.gpg] http://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 | apt-key --keyring /usr/share/keyrings/cloud.google.gpg add - && apt-get update -y && apt-get install google-cloud-sdk -y
1 change: 1 addition & 0 deletions roles/prepare/vars/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ common_packages:
- "dumb-init"
- "curl"
- "ca-certificates"
- "gettext"
- "htop"
- "rsync"
- "vim"
Expand Down

0 comments on commit d956090

Please sign in to comment.