Skip to content

Instantly share code, notes, and snippets.

@pdcastro
Last active August 14, 2019 14:37
Show Gist options
  • Save pdcastro/d9739b9b81ad75ab5957bd5b8b405080 to your computer and use it in GitHub Desktop.
Save pdcastro/d9739b9b81ad75ab5957bd5b8b405080 to your computer and use it in GitHub Desktop.
Sample 'eu.gcr.io' registry secrets usage with "balena build"
FROM eu.gcr.io/buoyant-idea-226013/arm32v7/busybox
RUN uname -a
CMD while : ; do echo "(Plain Dockerfile 3) $(uname -a)"; sleep ${INTERVAL=5}; done
'eu.gcr.io':
username: _json_key
password: '{
"type": "service_account",
"project_id": "buoyant-idea-226013",
"private_key_id": "454ddbbe3b6b31f50dde337f3fed8025871c5b6e",
"private_key": "-----BEGIN PRIVATE KEY-----\nA+LONG+PRIVATE+KEY+STRING\nWITH+ESCAPED+LINE+BREAKS+AND\NMORE+THAN+A+THOUSAND+CHARACTERS=\n-----END PRIVATE KEY-----\n",
"client_email": "container-registry-test@buoyant-idea-226013.iam.gserviceaccount.com",
"client_id": "107317699110545445744",
"auth_uri": "https://accounts.google.com/o/oauth2/auth",
"token_uri": "https://oauth2.googleapis.com/token",
"auth_provider_x509_cert_url": "https://www.googleapis.com/oauth2/v1/certs",
"client_x509_cert_url": "https://www.googleapis.com/robot/v1/metadata/x509/container-registry-test%40buoyant-idea-226013.iam.gserviceaccount.com"
}'
DEBUG=1 balena build -a test-project --registry-secrets sample_secrets.yml .
@pdcastro
Copy link
Author

  • Note the escaping of line breaks in the "password" field of the sample_secrets.yml file above. (By the way, the "private key id" and "private key" fields have been modified: not real values, just a sample.)
  • The 'eu.gcr.io' value must match between the Dockerfile FROM line and the key entry in the sample_secrets.yml file.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment