Skip to content

Instantly share code, notes, and snippets.

@xingxing
Last active December 6, 2018 12:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save xingxing/886b3f5479a7a8f04191915d511a433e to your computer and use it in GitHub Desktop.
Save xingxing/886b3f5479a7a8f04191915d511a433e to your computer and use it in GitHub Desktop.
#!/bin/bash
mkdir -p cloudbuild
projectName=$(pwd | awk -F / '{print $NF}')
echo $projectName
touch cloudbuild/production.yaml cloudbuild/scambio.yaml
cat <<EOF > cloudbuild/scambio.yaml
steps:
- name: 'gcr.io/cloud-builders/docker'
args: ['build',
'-t', 'gcr.io/\$PROJECT_ID/github.com/scambio/$projectName:\$COMMIT_SHA',
'-t', 'gcr.io/\$PROJECT_ID/github.com/scambio/$projectName:latest',
'--cache-from', 'gcr.io/\$PROJECT_ID/github.com/scambio/$projectName:latest',
'.']
images:
- 'gcr.io/\$PROJECT_ID/github.com/scambio/$projectName:\$COMMIT_SHA'
- 'gcr.io/\$PROJECT_ID/github.com/scambio/$projectName:latest'
logsBucket: gs://cloud-build.logs.deq.peatio.com/scambio
EOF
cat <<EOF > cloudbuild/production.yaml
steps:
- name: 'gcr.io/cloud-builders/docker'
args: ['build',
'-t', 'gcr.io/\$PROJECT_ID/github.com/peatio/$projectName:\$TAG_NAME',
'-t', 'gcr.io/\$PROJECT_ID/github.com/peatio/$projectName:latest',
'--cache-from', 'gcr.io/\$PROJECT_ID/github.com/peatio/$projectName:latest',
'.']
images:
- 'gcr.io/\$PROJECT_ID/github.com/peatio/$projectName:\$TAG_NAME'
- 'gcr.io/\$PROJECT_ID/github.com/peatio/$projectName:latest'
logsBucket: gs://cloud-build.logs.deq.peatio.com/production
EOF
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment