0
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

Google Cloud Container Builderでassets:precompile結果をbucketにupload

Last updated at Posted at 2017-04-20

google cloud storageに静的なassetファイルをuploadしておくことによって簡単にCDN化ができるためbuild processに組み込んでしまう。

ポイントはasset-precompileの部分で
buildしたcontainerを立ち上げるときに -vで build中のworkspaceをmountしてやること

  1. docker build
  2. assets:precompileを実行してbuild実行中の /workspaceに書き込む
  3. gsutlでcp
steps:
- id: 'build-master'
  name: 'gcr.io/cloud-builders/docker'
  args: ['build', '-t', 'gcr.io/$PROJECT_ID/app:$REVISION_ID', '.']
- id: 'asset-precompile'
  name: 'gcr.io/cloud-builders/docker'
  args: ['run', '-v', '/workspace/assets-output:/app/public/assets', 'gcr.io/$PROJECT_ID/app:$REVISION_ID', 'bundle', 'exec', 'rake', 'assets:precompile']
- id: 'upload-asset'
  name: 'gcr.io/cloud-builders/gsutil'
  args: ['cp', '-r', '/workspace/assets-output/*', 'gs://${YOUR_BUCKET}/assets']

参考

0
2
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?