{"id":448,"date":"2018-04-14T10:34:09","date_gmt":"2018-04-14T01:34:09","guid":{"rendered":"https:\/\/p-corporate-blog-cms.mmmcorp.co.jp\/blog\/2018\/04\/14\/circleci2codebuild"},"modified":"2018-04-14T10:34:09","modified_gmt":"2018-04-14T01:34:09","slug":"circleci2codebuild","status":"publish","type":"post","link":"https:\/\/p-corporate-blog-cms.mmmcorp.co.jp\/blog\/2018\/04\/14\/circleci2codebuild\/","title":{"rendered":"CircleCI 2.0\u306e\u51e6\u7406\u3092AWS CodeBuild\u3067\u5b9f\u884c\u3059\u308b"},"content":{"rendered":"
\u5f0a\u793e\u3067\u306f\u3001\u57fa\u672c\u7684\u306b\u3069\u306e\u30d7\u30ed\u30b8\u30a7\u30af\u30c8\u3067\u3082 CircleCI<\/a> \u3092\u5229\u7528\u3057\u3066\u3001 \u4eca\u56de\u306e\u524d\u63d0\u6761\u4ef6\u3068\u3057\u3066\u306f\u4e0b\u8a18\u306e\u3068\u304a\u308a\u3068\u306a\u3063\u3066\u3044\u308b\u3002<\/p>\n In a multi-image configuration job, all steps are executed in the container created by the first image listed. All containers run in a common network and every exposed port will be available on localhost from a primary container.<\/p>\n<\/blockquote>\n \u8907\u6570\u30b3\u30f3\u30c6\u30ca\u306e\u8a2d\u5b9a\u3092\u5165\u308c\u3066\u304a\u3051\u3070\u3001\u6700\u521d\u306b\u5b9a\u7fa9\u3057\u305f\u30b3\u30f3\u30c6\u30ca\u5185\u3067\u30b3\u30de\u30f3\u30c9\u304c\u5b9f\u884c\u3055\u308c\u3001\u305d\u306e\u4ed6\u306e\u30b3\u30f3\u30c6\u30ca\u306b\u3082\u6700\u521d\u306b\u5b9a\u7fa9\u3057\u305f\u30b3\u30f3\u30c6\u30ca\u306e \u3057\u304b\u3057\u3001 <\/p>\n \u30c6\u30b9\u30c8\u5b9f\u884c\u306b\u5fc5\u8981\u306a\u30df\u30c9\u30eb\u30a6\u30a7\u30a2\u3092\u5168\u90e81\u3064\u306e\u30b3\u30f3\u30c6\u30ca\u306b\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3057\u3066\u3057\u307e\u3044\u3001\u305d\u308c\u3092\u4f7f\u3046\u306e\u3082\u3042\u308a\u304b\u3082\u3057\u308c\u306a\u3044\u304c\u2026\u2026\u3002<\/p>\n \u306a\u3069\u306e\u30c7\u30e1\u30ea\u30c3\u30c8\u304c\u3042\u308b\u3002<\/p>\n \u305d\u3053\u3067\u3001 library\/docker - Docker Hub<\/a> \u3067\u3001 <\/p>\n library\/docker - Docker Hub<\/a> \u306b\u3082\u6ce8\u610f\u66f8\u304d\u304c\u3042\u308b\u901a\u308a\u3001 Note: --privileged is required for Docker-in-Docker to function properly, but it should be used with care as it provides full access to the host environment, as explained in the relevant section of the Docker documentation.<\/p>\n<\/blockquote>\n <\/p>\n AWS CodeBuild \u306e\u30ab\u30b9\u30bf\u30e0 Docker \u30a4\u30e1\u30fc\u30b8\u306e\u30b5\u30f3\u30d7\u30eb - AWS CodeBuild<\/a> \u306b\u4f8b\u304c\u3042\u308b\u3088\u3046\u306b\u3001 \u4e0a\u8ff0\u306e\u624b\u9806\u3092\u307e\u3068\u3081\u308b\u3068\u3001<\/p>\n \u3068\u3044\u3046\u5f62\u306b\u306a\u308b\u3002 library\/docker - Docker Hub<\/a> \u5f0a\u793e\u3067\u306f\u3001\u57fa\u672c\u7684\u306b\u3069\u306e\u30d7\u30ed\u30b8\u30a7\u30af\u30c8\u3067\u3082 CircleCI \u3092\u5229\u7528\u3057\u3066\u3001 CI\/CD \u3092\u884c\u3063\u3066\u3044\u308b\u3002\u305f\u3060\u3001\u304a\u5ba2\u69d8\u306b\u3088\u3063\u3066\u306f\u3001AWS\u74b0\u5883\u3067 CI\/CD \u3082\u5b8c\u7d50\u3055\u305b\u305f\u3044\u3068\u3044\u3046\u3054\u8981\u671b\u3082\u3042\u308b\u3002\u4eca\u56de\u306f\u3001\u666e\u6bb5 CircleCI \u3067\u884c\u3063\u3066\u3044\u308b CI\/CD \u3092\u3001 AWS CodeBuild \u3092\u4f7f\u3063\u3066\u884c\u3046\u5834\u5408\u306e\u6ce8\u610f\u70b9\u3092\u307e\u3068\u3081\u3066\u307f\u308b\u3002 \u524d\u63d0 \u4eca\u56de\u306e\u524d\u63d0\u6761\u4ef6\u3068\u3057\u3066\u306f\u4e0b\u8a18\u306e\u3068\u304a\u308a\u3068\u306a\u3063\u3066\u3044\u308b\u3002 \u958b\u767a\u74b0\u5883\u306f\u3001 docker- […]<\/p>\n","protected":false},"author":3,"featured_media":826,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[13,18],"tags":[44,307],"aioseo_notices":[],"_links":{"self":[{"href":"https:\/\/p-corporate-blog-cms.mmmcorp.co.jp\/wp-json\/wp\/v2\/posts\/448"}],"collection":[{"href":"https:\/\/p-corporate-blog-cms.mmmcorp.co.jp\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/p-corporate-blog-cms.mmmcorp.co.jp\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/p-corporate-blog-cms.mmmcorp.co.jp\/wp-json\/wp\/v2\/users\/3"}],"replies":[{"embeddable":true,"href":"https:\/\/p-corporate-blog-cms.mmmcorp.co.jp\/wp-json\/wp\/v2\/comments?post=448"}],"version-history":[{"count":0,"href":"https:\/\/p-corporate-blog-cms.mmmcorp.co.jp\/wp-json\/wp\/v2\/posts\/448\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/p-corporate-blog-cms.mmmcorp.co.jp\/wp-json\/wp\/v2\/media\/826"}],"wp:attachment":[{"href":"https:\/\/p-corporate-blog-cms.mmmcorp.co.jp\/wp-json\/wp\/v2\/media?parent=448"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/p-corporate-blog-cms.mmmcorp.co.jp\/wp-json\/wp\/v2\/categories?post=448"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/p-corporate-blog-cms.mmmcorp.co.jp\/wp-json\/wp\/v2\/tags?post=448"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}CI\/CD<\/code> \u3092\u884c\u3063\u3066\u3044\u308b\u3002
\u305f\u3060\u3001\u304a\u5ba2\u69d8\u306b\u3088\u3063\u3066\u306f\u3001AWS\u74b0\u5883\u3067 CI\/CD<\/code> \u3082\u5b8c\u7d50\u3055\u305b\u305f\u3044\u3068\u3044\u3046\u3054\u8981\u671b\u3082\u3042\u308b\u3002
\u4eca\u56de\u306f\u3001\u666e\u6bb5 CircleCI<\/code> \u3067\u884c\u3063\u3066\u3044\u308b
CI\/CD<\/code> \u3092\u3001 AWS CodeBuild<\/a> \u3092\u4f7f\u3063\u3066\u884c\u3046\u5834\u5408\u306e\u6ce8\u610f\u70b9\u3092\u307e\u3068\u3081\u3066\u307f\u308b\u3002<\/p>\n
\u524d\u63d0<\/h2>\n
\n
docker-compose<\/code> \u3067\u3001\u30a2\u30d7\u30ea\u7528\u30b3\u30f3\u30c6\u30ca\u3001DB\u7528\u30b3\u30f3\u30c6\u30ca\u306a\u3069\u8907\u6570\u306e\u30b3\u30f3\u30c6\u30ca\u3092\u4f7f\u3063\u3066\u958b\u767a\u3092\u884c\u3063\u3066\u3044\u308b<\/li>\n
CircleCI<\/code> \u3067\u3082\u3001\u8907\u6570\u306e\u30b3\u30f3\u30c6\u30ca\u3092\u4f7f\u3063\u3066\u3001\u30c6\u30b9\u30c8\u3092\u3057\u3066\u3044\u308b<\/li>\n
AWS CodeBuild<\/code> \u3067\u3082\u8907\u6570\u30b3\u30f3\u30c6\u30ca\u3092\u4f7f\u3063\u3066\u30c6\u30b9\u30c8\u3092\u3057\u305f\u3044<\/li>\n<\/ul>\n
AWS CodeBuild \u3067\u8907\u6570\u30b3\u30f3\u30c6\u30ca\u4f7f\u3044\u305f\u3044<\/h2>\n
CircleCI 2.0<\/code> \u3067\u306f\u3001Using Multiple Docker Images<\/a> \u306b\u8a18\u8f09\u304c\u3042\u308b\u3068\u304a\u308a\u3001<\/p>\n
\n
localhost<\/code> \u304b\u3089\u4ed6\u306e\u30b3\u30f3\u30c6\u30ca\u306b\u5bfe\u3057\u3066\u3082\u5bb9\u6613\u306b\u63a5\u7d9a\u3067\u304d\u3066\u3057\u307e\u3046\u3002 <\/p>\n
AWS CodeBuild<\/code> \u3067\u306f\u3001 \u8907\u6570\u30b3\u30f3\u30c6\u30ca\u306e\u8a2d\u5b9a\u304c\u3067\u304d\u306a\u3044<\/strong> \u3002<\/p>\n
\n
docker\/dind<\/code> \u30a4\u30e1\u30fc\u30b8\u3092\u4f7f\u3046\u3002
\ndind<\/code> \u306b
docker-compose<\/code> \u3092\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3057\u3066\u3001
docker-compose<\/code> \u3092\u4f7f\u3063\u3066\u8907\u6570\u30b3\u30f3\u30c6\u30ca\u7ba1\u7406\uff06\u5b9f\u884c\u3092\u3057\u3088\u3046\u3068\u3044\u3046\u65b9\u6cd5\u3092\u8a66\u307f\u305f\u3002<\/p>\n
docker:dind<\/code><\/h2>\n
dind<\/code> \u306f Docker in Docker<\/strong> \u306e\u7565\u3002
Docker<\/code> \u30b3\u30f3\u30c6\u30ca\u4e0a\u3067\u3001
Docker<\/code> \u306e\u30c7\u30fc\u30e2\u30f3\u3092\u8d77\u52d5\u3057\u3066\u3001\u5225\u306e(\u8907\u6570\u306e)
Docker<\/code> \u30b3\u30f3\u30c6\u30ca\u3092\u8d77\u52d5\u3067\u304d\u308b\u3082\u306e\u3002<\/p>\n
dind<\/code> \u304c\u5165\u3063\u3066\u3044\u308b\u3082\u306e\u3092\u4f7f\u3046\u3002
\u4eca\u56de\u306f\u4e0b\u8a18\u306e\u3088\u3046\u306b\u3001 docker:dind<\/code> \u3092\u4f7f\u3046\u3088\u3046\u306b\u8a2d\u5b9a\u3057\u305f\u3002<\/p>\n
buildspec.yml<\/code> \u306e
install<\/code> \u30d5\u30a7\u30fc\u30ba\u3067
docker-compose<\/code> \u30a4\u30f3\u30b9\u30c8\u30fc\u30eb<\/h2>\n
docker:dind<\/code> \u306b
docker-compose<\/code> \u3092\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3059\u308b\u3002
pip<\/code> \u3092\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3057\u3066\u3001
pip<\/code> \u30b3\u30de\u30f3\u30c9\u3067\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3002<\/p>\n
version: 0.2\n\nphases:\n install:\n commands:\n - apk add --no-cache py-pip\n - pip install docker-compose<\/code><\/pre>\n
privileged<\/h2>\n
--privileged<\/code> \u3067\u8d77\u52d5\u3059\u308b\u5fc5\u8981\u304c\u3042\u308b\u305f\u3081\u3001
CodeBuild<\/code> \u306e\u7ba1\u7406\u753b\u9762\u3067\u3082
Privileged<\/code> \u306b\u30c1\u30a7\u30c3\u30af\u3092\u5165\u308c\u308b\u3002<\/p>\n
\n
dockerd<\/code> \u3092\u30d0\u30c3\u30af\u30b0\u30e9\u30a6\u30f3\u30c9\u3067\u8d77\u52d5<\/h2>\n
install<\/code> \u306e\u30d5\u30a7\u30fc\u30ba\u3067\u3001\u30d0\u30c3\u30af\u30b0\u30e9\u30a6\u30f3\u30c9\u3067
dockerd<\/code> \u3092\u8d77\u52d5\u3059\u308b\u3088\u3046\u306b\u3057\u3066\u304a\u304f\u3002<\/p>\n
version: 0.2\n\nphases:\n install:\n commands:\n - nohup \/usr\/local\/bin\/dockerd --host=unix:\/\/\/var\/run\/docker.sock --host=tcp:\/\/0.0.0.0:2375 --storage-driver=overlay&\n - timeout -t 15 sh -c "until docker info; do echo .; sleep 1; done"<\/code><\/pre>\n
buildspec.yml<\/code><\/h2>\n
\n
install<\/code> \u30d5\u30a7\u30fc\u30ba\u3067
docker-compose<\/code> \u3092\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3001
dockerd<\/code> \u3092\u8d77\u52d5<\/li>\n
pre_build<\/code> \u30d5\u30a7\u30fc\u30ba\u3067
docker-compose build<\/code> \u5b9f\u884c\u3057\u3066\u3001\u30c6\u30b9\u30c8\u306b\u5fc5\u8981\u306a\u8907\u6570\u306e\u30b3\u30f3\u30c6\u30ca\u3092\u30d3\u30eb\u30c9<\/li>\n
build<\/code> \u30d5\u30a7\u30fc\u30ba\u3067
docker-compose run<\/code> \u306b\u3066\u30c6\u30b9\u30c8\u5b9f\u884c<\/li>\n<\/ul>\n
buildspec.yml<\/code> \u306f\u4e0b\u8a18\u306e\u3088\u3046\u306b\u306a\u3063\u305f\u3002<\/p>\n
phases:\n install:\n commands:\n - apk add --no-cache py-pip\n - pip install docker-compose\n - nohup \/usr\/local\/bin\/dockerd --host=unix:\/\/\/var\/run\/docker.sock --host=tcp:\/\/127.0.0.1:2375 --storage-driver=overlay&\n - timeout -t 15 sh -c "until docker info; do echo .; sleep 1; done"\n pre_build:\n commands:\n - docker-compose build\n build:\n commands:\n - docker-compose run app yarn test<\/code><\/pre>\n
\u53c2\u8003URL<\/h2>\n
\nAWS CodeBuild \u306e\u30ab\u30b9\u30bf\u30e0 Docker \u30a4\u30e1\u30fc\u30b8\u306e\u30b5\u30f3\u30d7\u30eb - AWS CodeBuild<\/a>
\ndind(Docker in Docker)\u3067\u8907\u6570\u306edocker-compose\u3092\u7ba1\u7406\u3059\u308b \u00b7 tehepero note(\u30fb\u03c9<) 2.0<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"