Last active
March 27, 2020 11:11
-
-
Save ljulliar/8d01301b2e83176bd9670095b4d4b3d8 to your computer and use it in GitHub Desktop.
Cloud Build YAML file (Photo Album app on Google Cloud Run)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| steps: | |
| # Decrypt Rails Master key file | |
| - name: gcr.io/cloud-builders/gcloud | |
| args: ["kms", "decrypt", "--ciphertext-file=./config/master.key.enc", | |
| "--plaintext-file=./config/master.key", | |
| "--location=us-central1","--keyring=photo-album", | |
| "--key=rails_master_key"] | |
| # Decrypt Photo Album service account credentials | |
| - name: gcr.io/cloud-builders/gcloud | |
| args: ["kms", "decrypt", "--ciphertext-file=./config/photo_album_runner.key.enc", | |
| "--plaintext-file=./config/photo_album_runner.key", | |
| "--location=us-central1","--keyring=photo-album", | |
| "--key=photo_album_runner_key"] | |
| # Build image with tag 'latest' and pass decrypted Rails DB password as argument | |
| - name: 'gcr.io/cloud-builders/docker' | |
| args: ['build', '--tag', 'gcr.io/$PROJECT_ID/photo_album:latest', | |
| '--build-arg', 'DB_PWD', '.'] | |
| secretEnv: ['DB_PWD'] | |
| # Push new image to Google Container Registry | |
| - name: 'gcr.io/cloud-builders/docker' | |
| args: ['push', 'gcr.io/$PROJECT_ID/photo_album:latest'] | |
| secrets: | |
| - kmsKeyName: projects/project_id/locations/us-central1/keyRings/photo-album/cryptoKeys/db_pwd_key | |
| secretEnv: | |
| DB_PWD: "your_encrypted_production_database_password_here" | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment