{"id":5449,"date":"2022-05-01T15:53:27","date_gmt":"2022-05-01T06:53:27","guid":{"rendered":"https:\/\/akamist.com\/blog\/?p=5449"},"modified":"2023-04-15T16:37:00","modified_gmt":"2023-04-15T07:37:00","slug":"aws-amplify%e3%81%a7%e5%8d%98%e4%b8%80%e3%81%aedocker%e3%82%b3%e3%83%b3%e3%83%86%e3%83%8a%e3%82%92%e3%83%87%e3%83%97%e3%83%ad%e3%82%a4%e3%81%99%e3%82%8b%e6%96%b9%e6%b3%95","status":"publish","type":"post","link":"https:\/\/akamist.com\/blog\/archives\/5449","title":{"rendered":"AWS Amplify\u3067\u5358\u4e00\u306eDocker\u30b3\u30f3\u30c6\u30ca\u3092\u30c7\u30d7\u30ed\u30a4\u3059\u308b\u65b9\u6cd5"},"content":{"rendered":"<p>AWS Amplify\u3067\u3001docker-compose\u3092\u4f7f\u308f\u305a\u306b\u3001Dockerfile\u3060\u3051\u7528\u610f\u3057\u3066\u5358\u4e00\u306eDocker\u30b3\u30f3\u30c6\u30ca\u3092\u30c7\u30d7\u30ed\u30a4\u3059\u308b\u65b9\u6cd5\u3092\u8aac\u660e\u3057\u307e\u3059\u3002<br \/>\n(AWS\u30c9\u30ad\u30e5\u30e1\u30f3\u30c8\u306e\u548c\u8a33\u3067\u3059)<\/p>\n<h2>TL;DR<\/h2>\n<ul>\n<li><code>Dockerfile<\/code>\u306f\u3001*.git\u306e\u30eb\u30fc\u30c8\u3067\u306f\u306a\u304f\u3066\u3001<code>amplify\/backend\/api\/&lt;\u540d\u524d&gt;\/src\/Dockerfile<\/code>\u306b\u7f6e\u304f\u3002\n<ul>\n<li><code>amplify\/backend\/api\/...<\/code>\u306f\u3001<code>amplify init<\/code>\u3068<code>amplify add api<\/code>\u30b3\u30de\u30f3\u30c9\u3067\u751f\u6210\u3067\u304d\u308b\u3002<\/li>\n<\/ul>\n<\/li>\n<li>\u30dd\u30fc\u30c8\u306f\u30c7\u30d5\u30a9\u30eb\u30c8\u306780\u3001\u5909\u66f4\u3057\u305f\u3044\u5834\u5408\u306fDockerfile\u306eEXPOSE\u3067\u6307\u5b9a\u3059\u308b\u3002<\/li>\n<li>\u30ed\u30fc\u30ab\u30eb\u3067\u4e8b\u524d\u30c6\u30b9\u30c8\u3059\u308b\u3068\u304d\u306f\u4e0b\u8a18\u306e\u624b\u9806\n<ul>\n<li><code>cd amplify\/backend\/api\/&lt;\u540d\u524d&gt;\/src; docker build -t<\/code>\u3057\u3066<code>docker run<\/code>\u3067\u304d\u308b\u3053\u3068\u3092\u78ba\u8a8d\u3002<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<h2>\u624b\u9806<\/h2>\n<h3>\u5358\u4e00\u306e\u30b3\u30f3\u30c6\u30ca\u3092\u4f7f\u3063\u305f\u30c7\u30d7\u30ed\u30a4<\/h3>\n<p>\u5358\u4e00Dockerfile\u3092\u4f7f\u3046\u5834\u5408\u3001Dockerfile\u3067\u30d3\u30eb\u30c9\u3055\u308c\u305f\u5358\u4e00\u30b3\u30f3\u30c6\u30ca\u3067\u52d5\u4f5c\u3059\u308b\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u3092\u3001Amplify CLI\u3067AWS Fargate\u306b\u30c7\u30d7\u30ed\u30a4\u3059\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002<\/p>\n<p>Dockerfile\u306e\u4f7f\u3044\u65b9\u306b\u6163\u308c\u3066\u3044\u306a\u3044\u65b9\u306f\u3001<a href=\"https:\/\/nodejs.org\/en\/docs\/guides\/nodejs-docker-webapp\/\">Dockerizing a Node.js web app guide<\/a>\u3092\u307f\u308b\u304b\u3001Amplify\u304c\u63d0\u4f9b\u3059\u308b\u30c6\u30f3\u30d7\u30ec\u30fc\u30c8\u3067API\u3092\u8ffd\u52a0\u3057\u3066\u304f\u3060\u3055\u3044\u3002<\/p>\n<p>\u4ee5\u4e0b\u306b\u7c21\u5358\u306aDockerfile\u306e\u4f8b\u3092\u793a\u3057\u307e\u3059\u3002\u3053\u308c\u306fNodeJS\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\uff08index.js\uff09\u3092\u3001\u5168\u3066\u306e\u30bd\u30fc\u30b9\u30d5\u30a1\u30a4\u30eb\u3092\u30b3\u30d4\u30fc\u3057\u3001\u4f9d\u5b58\u95a2\u4fc2\u3092\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3057\u305f\u30d3\u30eb\u30c9\u30a4\u30e1\u30fc\u30b8\u3067\u8d77\u52d5\u3059\u308b\u3082\u306e\u3067\u3059\u3002\u3053\u306e\u4f8b\u3067\u306f\u3001\u74b0\u5883\u5909\u6570\u306e\u6307\u5b9a\u3084\u3001\u30b3\u30f3\u30c6\u30ca\u306e\u901a\u4fe1\u30dd\u30fc\u30c8\u306e\u5b9a\u7fa9\u306bEXPOSE\u30b9\u30c6\u30fc\u30c8\u30e1\u30f3\u30c8\u3092\u4f7f\u7528\u3059\u308b\u65b9\u6cd5\u3082\u7d39\u4ecb\u3057\u3066\u3044\u307e\u3059\u3002<\/p>\n<pre><code class=\"language-dockerfile\">FROM public.ecr.aws\/bitnami\/node:14.15.1-debian-10-r8\n\nENV PORT=8080\nEXPOSE 8080\n\nWORKDIR \/usr\/src\/app\n\nCOPY package*.json .\/\nRUN npm install\nCOPY .\n\nCMD [ \"node\", \"index.js\" ]\n<\/code><\/pre>\n<p>Dockerfile\u306bEXPOSE\u6587\u3092\u8a18\u8ff0\u3057\u3066\u3001\u30b3\u30f3\u30c6\u30ca\u3068\u901a\u4fe1\u3059\u308b\u305f\u3081\u306e\u30dd\u30fc\u30c8\u3092\u6307\u5b9a\u3059\u308b\u5fc5\u8981\u304c\u3042\u308a\u307e\u3059\u3002\u3082\u3057\u6307\u5b9a\u304c\u306a\u3044\u5834\u5408\u306f\u300180\u756a\u30dd\u30fc\u30c8\u3092\u4f7f\u7528\u3059\u308b\u3088\u3046Amplify\u306f\u30b5\u30b8\u30a7\u30b9\u30c8\u3057\u307e\u3059\u3002<\/p>\n<h3>\u30ed\u30fc\u30ab\u30eb\u3067\u306e\u958b\u767a\u30fb\u30c6\u30b9\u30c8<\/h3>\n<p>amplify push\u3067\u30c7\u30d7\u30ed\u30a4\u3059\u308b\u524d\u306b\u3001\u307e\u305a\u30ed\u30fc\u30ab\u30eb\u3067\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u3092\u30c6\u30b9\u30c8\u3059\u308b\u3053\u3068\u3092\u304a\u52e7\u3081\u3057\u307e\u3059\u3002\u3055\u3082\u306a\u3044\u3068\u3001\u4f9d\u5b58\u95a2\u4fc2\u304c\u898b\u3064\u304b\u3089\u306a\u3044\u306a\u3069\u306e\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u306e\u554f\u984c\u304c\u3042\u308b\u5834\u5408\u3001Fargate\u30bf\u30b9\u30af\u306e\u8d77\u52d5\u306b\u5931\u6557\u3059\u308b\u3053\u3068\u304c\u3042\u308a\u307e\u3059\u3002<\/p>\n<p>\u5358\u4e00\u306eDocker\u30d5\u30a1\u30a4\u30eb\u3092\u4f7f\u3046\u5834\u5408\u3001\u4ee5\u4e0b\u306e\u4f8b\u306e\u3088\u3046\u306b<code>amplify\/backend\/api\/&lt;\u540d\u524d&gt;\/src<\/code> \u306b\u79fb\u52d5\u3057\u3066<code>docker build -t<\/code>\u3092\u5b9f\u884c\u3057\u3066\u30a4\u30e1\u30fc\u30b8\u3092\u69cb\u7bc9\u3057\u30bf\u30b0\u4ed8\u3051\u3057\u3001 <code>docker run<\/code>\u3067\u30b3\u30f3\u30c6\u30ca\u3092\u8d77\u52d5\u3059\u308b\u3053\u3068\u3067\u78ba\u8a8d\u3067\u304d\u307e\u3059\u3002<\/p>\n<pre><code class=\"language-bash\">$ cd .\/amplify\/backend\/api\/&lt;name&gt;\/src\n$ docker build -t node-app:1.0 .\n$ docker run -p 8080:8080 -d node-app:1.0 .\n$ curl -i localhost:8080\n<\/code><\/pre>\n<p>\u307e\u305f\u3001Node\u3084Python\u3067<code>node index.js<\/code>\u3084<code>python server.py<\/code>\u3092\u5b9f\u884c\u3059\u308b\u306a\u3069\u3001\u6a19\u6e96\u7684\u306a\u30c4\u30fc\u30eb\u3067\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u3092\u5b9f\u884c\u3059\u308b\u3053\u3068\u3082\u53ef\u80fd\u3067\u3059\u3002<code>Dockerfile<\/code>\u3068\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u306e\u30b3\u30fc\u30c9\u304c\u30ed\u30fc\u30ab\u30eb\u3067\u52d5\u4f5c\u3059\u308b\u3053\u3068\u3092\u78ba\u8a8d\u3067\u304d\u305f\u3089\u3001<code>amplify push<\/code>\u3092\u5b9f\u884c\u3057\u307e\u3059\u3002<code>amplify\/backend\/api\/&lt;\u540d\u524d&gt;\/src<\/code>\u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u304c\u30d3\u30eb\u30c9\u30d1\u30a4\u30d7\u30e9\u30a4\u30f3\u7528\u306b\u30d0\u30f3\u30c9\u30eb\u3055\u308c\u3001Docker\u306e\u30a4\u30e1\u30fc\u30b8\u3092Fargate\u306b\u30c7\u30d7\u30ed\u30a4\u3059\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002<\/p>\n<p>\u30c7\u30d7\u30ed\u30a4\u304c\u7d42\u4e86\u3057\u305f\u3089\u30a8\u30f3\u30c9\u30dd\u30a4\u30f3\u30c8URL\u304c\u51fa\u529b\u3055\u308c\u3001\u30af\u30e9\u30a4\u30a2\u30f3\u30c8\u306e\u8a2d\u5b9a\u30d5\u30a1\u30a4\u30eb\u304c\u66f4\u65b0\u3055\u308c\u307e\u3059\u3002<\/p>\n<h2>\u53c2\u8003\u8cc7\u6599<\/h2>\n<p><a href=\"https:\/\/docs.amplify.aws\/cli\/usage\/containers\/#deploy-a-single-container\">Deploy a single container<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>AWS Amplify\u3067\u3001docker-compose\u3092\u4f7f\u308f\u305a\u306b\u3001Dockerfile\u3060\u3051\u7528\u610f\u3057\u3066\u5358\u4e00\u306eDocker\u30b3\u30f3\u30c6\u30ca\u3092\u30c7\u30d7\u30ed\u30a4\u3059\u308b\u65b9\u6cd5\u3092\u8aac\u660e\u3057\u307e\u3059\u3002 (AWS\u30c9\u30ad\u30e5\u30e1\u30f3\u30c8\u306e\u548c\u8a33\u3067\u3059) TL;DR Dockerfi [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":743,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[1],"tags":[338,29,75,339],"aioseo_notices":[],"jetpack_featured_media_url":"https:\/\/akamist.com\/blog\/wp-content\/uploads\/2017\/08\/icon_aws.png","jetpack-related-posts":[{"id":5455,"url":"https:\/\/akamist.com\/blog\/archives\/5455","url_meta":{"origin":5449,"position":0},"title":"AWS: amplify push\u3057\u305f\u3089\u3001\u30a8\u30e9\u30fcNo definition available\u304c\u51fa\u308b\u3068\u304d","date":"2022\u5e745\u67081\u65e5","format":false,"excerpt":"AWS Amplify\u3067docker-compose\u3092\u4f7f\u3063\u3066\u30d0\u30c3\u30af\u30a8\u30f3\u30c9\u30b5\u30fc\u30d0\u3092\u5229\u7528\u3059\u308b\u3068\u304d\u306b\u3001`a\u2026","rel":"","context":"\u672a\u5206\u985e","img":{"alt_text":"","src":"https:\/\/i0.wp.com\/akamist.com\/blog\/wp-content\/uploads\/2017\/08\/icon_aws.png?resize=350%2C200&ssl=1","width":350,"height":200},"classes":[]},{"id":5470,"url":"https:\/\/akamist.com\/blog\/archives\/5470","url_meta":{"origin":5449,"position":1},"title":"docker-compose\u3067Laravel9 + PHP8.0\u306e\u74b0\u5883\u3092\u69cb\u7bc9\u3059\u308b","date":"2022\u5e745\u67081\u65e5","format":false,"excerpt":"docker-compose\u3092\u3064\u304b\u3063\u3066Laravel9\u3068PHP8.0\u306e\u5b9f\u884c\u74b0\u5883\u3092\u69cb\u7bc9\u3059\u308b\u624b\u9806\u3092\u8aac\u660e\u3057\u2026","rel":"","context":"Laravel","img":{"alt_text":"","src":"https:\/\/i0.wp.com\/akamist.com\/blog\/wp-content\/uploads\/2017\/11\/icon_laravel.png?resize=350%2C200&ssl=1","width":350,"height":200},"classes":[]},{"id":3498,"url":"https:\/\/akamist.com\/blog\/archives\/3498","url_meta":{"origin":5449,"position":2},"title":"Docker\u3067python3.6\u306e\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u3092\u4f5c\u3063\u3066\u5168\u3066\u524a\u9664\u3059\u308b\u307e\u3067\u306e\u6d41\u308c","date":"2019\u5e742\u670824\u65e5","format":false,"excerpt":"Docker\u3067alpine\u306epython3.6\u30b3\u30f3\u30c6\u30ca\u3092\u5229\u7528\u3057\u3066\u3001python\u306e\u30b9\u30af\u30ea\u30d7\u30c8\u3092\u5b9f\u884c\u3057\u3001\u2026","rel":"","context":"Docker","img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":3796,"url":"https:\/\/akamist.com\/blog\/archives\/3796","url_meta":{"origin":5449,"position":3},"title":"Dockerfile\u306ephp\u30b3\u30f3\u30c6\u30ca\u3067extension\u3092\u8ffd\u52a0\u3059\u308b\u65b9\u6cd5","date":"2019\u5e746\u670828\u65e5","format":false,"excerpt":"Dockerfile\u306e\u516c\u5f0fphp\u30b3\u30f3\u30c6\u30ca\u3092\u4f7f\u3063\u3066\u3044\u3066\u3001\u6a19\u6e96\u3067\u5165\u3063\u3066\u3044\u306a\u3044extension\u3092\u8ffd\u52a0\u3057\u305f\u2026","rel":"","context":"Docker","img":{"alt_text":"","src":"https:\/\/i0.wp.com\/akamist.com\/blog\/wp-content\/uploads\/2017\/11\/icon_docker.png?resize=350%2C200&ssl=1","width":350,"height":200},"classes":[]},{"id":4526,"url":"https:\/\/akamist.com\/blog\/archives\/4526","url_meta":{"origin":5449,"position":4},"title":"[PHP] ubuntu\u306eDocker\u3067\u30a8\u30e9\u30fcClass 'SimpleXMLElement' not found \u304c\u51fa\u305f\u3068\u304d\u306e\u5bfe\u51e6\u6cd5","date":"2021\u5e746\u670813\u65e5","format":false,"excerpt":"## \u767a\u751f\u3057\u305f\u30a8\u30e9\u30fc PHP\u3067Docker\u306e`ubuntu:20.04`\u30b3\u30f3\u30c6\u30ca\u3092\u4f7f\u7528\u3057\u3066\u3001AWS \u2026","rel":"","context":"\u672a\u5206\u985e","img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":4917,"url":"https:\/\/akamist.com\/blog\/archives\/4917","url_meta":{"origin":5449,"position":5},"title":"PHP, Docker, PHPStorm\u3067XDebug3\u3092\u4f7f\u3048\u308b\u3088\u3046\u306b\u3059\u308b","date":"2021\u5e7412\u670831\u65e5","format":false,"excerpt":"PHPStorm\u306eDocker\u30b3\u30f3\u30c6\u30ca\u3092\u4f7f\u7528\u3057\u305f\u958b\u767a\u3067XDebug3\u3092\u4f7f\u3048\u308b\u3088\u3046\u306b\u3059\u308b\u305f\u3081\u306e\u8a2d\u5b9a\u624b\u9806\u2026","rel":"","context":"\u672a\u5206\u985e","img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]}],"jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/akamist.com\/blog\/wp-json\/wp\/v2\/posts\/5449"}],"collection":[{"href":"https:\/\/akamist.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/akamist.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/akamist.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/akamist.com\/blog\/wp-json\/wp\/v2\/comments?post=5449"}],"version-history":[{"count":6,"href":"https:\/\/akamist.com\/blog\/wp-json\/wp\/v2\/posts\/5449\/revisions"}],"predecessor-version":[{"id":5570,"href":"https:\/\/akamist.com\/blog\/wp-json\/wp\/v2\/posts\/5449\/revisions\/5570"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/akamist.com\/blog\/wp-json\/wp\/v2\/media\/743"}],"wp:attachment":[{"href":"https:\/\/akamist.com\/blog\/wp-json\/wp\/v2\/media?parent=5449"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/akamist.com\/blog\/wp-json\/wp\/v2\/categories?post=5449"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/akamist.com\/blog\/wp-json\/wp\/v2\/tags?post=5449"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}