Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Sign up for free
Menu
Search
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Pricing
Search
Sign in
Sign up for free
docker-multi-stage-build
Search
Hirokazu Maruta
July 30, 2019
Technology
190
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
docker-multi-stage-build
dockerのマルチステージビルドについて登壇しました。
Lightning talk of docker and docker-multi-stage-build.
Hirokazu Maruta
July 30, 2019
More Decks by Hirokazu Maruta
See All by Hirokazu Maruta
encryption
mochisuna
0
130
わかった気になるチューリングマシン
mochisuna
0
82
Elementary algorithm
mochisuna
0
35
ssh-dynamic-forward
mochisuna
0
72
ServerlessFramework-Trello
mochisuna
0
40
TechBash Slack Reaction Award
mochisuna
0
56
techbash-clasp
mochisuna
0
110
vuejs-night-publish
mochisuna
0
1.3k
surprise-lt-for-intern-vol-2
mochisuna
0
63
Other Decks in Technology
See All in Technology
現場で役立つ技術負債の効果的な返済方法
masuda220
PRO
9
4.3k
例外の正しい扱い方 そのエラー try-catchして大丈夫?
jinwatanabe
3
510
事業課題から技術的負債に向き合う
sansantech
PRO
2
1.9k
AIに任せた品質は、誰が見立てるのか - AI時代のテストマネジメント
nakanao
2
1.8k
すぐできる衛星通信対応 あとは山奥に行くだけ
tatetate55
0
130
あけおめLINE 傾向とその対策
nasa9084
0
110
synctest時代のhttptest Go 1.27で変わるHTTPサーバテストの裏側 / go conference2026 synctest and httptest
budougumi0617
1
3k
登壇の自信を奪う3匹のオバケ / 3 Ghosts That Rob You of Your Confidence in Public Speaking
pauli
9
980
AIを活用するために決めた "やらないこと" - 価値に注目する / Not betting on AI
soudai
PRO
2
540
Claude in Chrome 入門 / Introduction to Claude in Chrome
cielo1985
0
840
10分で知る最近のOmarchy
komagata
0
350
OpenTelemetryのメトリクスをCloudWatchに送ってPromQLで見てみた
ota1022
0
150
Featured
See All Featured
Optimising Largest Contentful Paint
csswizardry
37
4k
VelocityConf: Rendering Performance Case Studies
addyosmani
331
25k
How to build an LLM SEO readiness audit: a practical framework
nmsamuel
1
910
How to Ace a Technical Interview
jacobian
281
24k
The Limits of Empathy - UXLibs8
cassininazir
1
670
Code Review Best Practice
trishagee
74
20k
AI Search: Where Are We & What Can We Do About It?
aleyda
0
7.9k
Chrome DevTools: State of the Union 2024 - Debugging React & Beyond
addyosmani
10
1.3k
Pawsitive SEO: Lessons from My Dog (and Many Mistakes) on Thriving as a Consultant in the Age of AI
davidcarrasco
0
240
Building AI with AI
inesmontani
PRO
1
1.2k
How GitHub (no longer) Works
holman
316
150k
<Decoding/> the Language of Devs - We Love SEO 2024
nikkihalliwell
1
330
Transcript
DockerͰ ϚϧνεςʔδϏϧυ͍ͨ͠ɻ ͨ͘͠ͳ͍ʁ SaaS ·Δͨ
Έͳ͞Μ
Docker
ͬͯ·͢ΑͶʁ
ͬͯ·͢ΑͶʁ ͜͜Ͱ2~3ਓ খटΛ͛Δఆ
େมศརͰ͢ΑͶ͐ɾɾɾ
େมศརͰ͢ΑͶ͐ɾɾɾ ͜͜Ͱ͞Βʹ2~3ਓ খटΛ͛Δఆ
ͳΕͦ͜ʂ
Λ
ͬͱ͍͍ײ͡ʹ͍͍ͨʂ
DockerͰ ϚϧνεςʔδϏϧυ͍ͨ͠ɻ ͨ͘͠ͳ͍ʁ SaaS ·Δͨ
ࣗݾհ • ؙాʢ·ΔͨͻΖ͔ͣʣ • Twitter: @mochi_suna • giftee.co SaaSνʔϜΤϯδχΞ •
झຯɿϐΞϊɺϘυήɺΞΠίϯ࡞ʢΧούʣ • ࣗಈԽେ͖ɻख࡞ۀ͖Β͍ɻ • github: https://github.com/mochisuna
ࠓ͢͜ͱ • Dockerͷ֓ཁ • ϚϧνεςʔδϏϧυ • ؆୯ʹσϞ ඪɿ • ૣޱʹͳΓ͗͢ͳ͍
• ్தͰ͛ग़͞ͳ͍ • ڬΊΔͱ͜ΖͰωλΛڬΉ
Docker֓ཁ
͍͖ͳΓ࣭Ͱ͢
DockerͬͯԿʁ
Docker is Կʁ ίϯςφܕͷΦʔϓϯιʔε ԾԽΤϯδϯͷҰͭ ※ݫີʹԾԽ͍ͯ͠ͳ͍
ίϯςφܕͷ͏·ຯ • VMܕͷԾԽΤϯδϯʹൺѹతʹܰྔ • VMܕΑΓߏங࡞ۀ͕༰қ ※ೝΊΔ ίϯςφܕ ΞϓϦ ϗετOS DockerΤϯδϯ
VMܕ ϗετOS ΞϓϦ ԾOS
͞Βʹ࣭Ͱ͢
ͦΕͧΕͷҧ͍Կʁ • Dockerfile • docker image • docker container
Docker༻ޠ • ίϯςφɿ୯ҰOS্Ͱִ͞Εͨϓϩηε • Πϝʔδɿίϯςφͷىಈઃఆɻܗʁ • DockerfileɿΠϝʔδͷߏஙઃఆ
Docker༻ޠ • ίϯςφɿ୯ҰOS্Ͱִ͞Εͨϓϩηε • Πϝʔδɿίϯςφͷىಈઃఆɻܗʁ • DockerfileɿΠϝʔδͷߏஙઃఆ ίϯςφ Πϝʔδ Dockerfile
༨ஊɿDockerΠϝʔδʹ͍ͭͯ • dokerΠϝʔδෳͷ ΠϝʔδΛϨΠϠͱͯ͠ ࣋ͭ • ͏ଆ୯ҰͷΠϝʔδ ʹݟ͑Δ • FROM
/ ADD /COPY શͯΠϝʔδϨΠϠʹ ૬ http://docs.docker.jp/engine/userguide/storagedriver/imagesandcontainers.html
ͬͱࡶʹ ϕʔεΠϝʔδ ॻ͖ࠐΈϨΠϠ dockerΠϝʔδ
͞Βʹ༨ஊɿbuild context • Γ͕ͪ • ߏங࣌ʹશϑΝΠϧɾσΟϨΫτϦ͕ೖΔ • COPY/ADD໋ྩͷ༗ແؔͳ͘ೖΔ docker image
build -t <IMAGE:TAG> . ͜Ε
ͳΜͰ͜Μͳ͔ͨ͠ʁ
Docker༑ୡ͔ͩΒ ʘ͜Θ͘ͳ͍Αʂʗ
༑ୡͱ ͬͱྑ͘ͳΓ͍͔ͨΒ
ຊɿϚϧνεςʔδϏϧυ
ϚϧνεςʔδϏϧυ • Docker17.05Ҏ߱ͷػೳ • ࠓ·Ͱ࡞͖ͬͯͨͷͷ͍͍ͱ͜औΓ • ՄಡੑɾอकੑΛ୲อ • Dockerfile/Πϝʔδͷ࠷దԽ
ͲΏ͜ͱʁ }։ൃεςʔδ }ຊ൪εςʔδ
طଘΠϝʔδΛFROMʹͰ͖Δ • ҰͭͷDockerfile͕ෳͷΠϝʔδΛಡΉ • ϛιʹͳΔͷ ࠷ऴతͳΠϝʔδʹඞཁͳͷ͚͕ͩೖΔ = ΠϝʔδαΠζͷେ෯ݮྔ --from=<as ໊લ>
target ࢦఆͰߏஙͰ͖Δ • ཉ͍͠εςʔδΛࢦఆͯ͠buildͰ͖Δ • ௨ৗͷbuildͩͱຊ൪εςʔδ·Ͱbuild͞ΕΔ docker build -- target
<as໊લ> } docker-composeͰεςʔδࢦఆՄ
σϞ • ࡞Γ·ͨ͠ • ࡶαʔόʔαΠυ • ࡶϑϩϯτΤϯυ • ςετ͘Β͍ॻ͚ https://github.com/mochisuna/vue-go-sample
Google Cloud RunʹσϓϩΠ • ίϚϯυ2ൃ gcloud beta run deploy <service_name>
\ --image gcr.io/<project_id>/<image_name> --region <region> gcloud builds submit \ -- project <project_id> \ -- tag gcr.io/<project_id>/<image_name> <dir>
·ͱΊ • Docker༑ୡɺ͜Θ͘ͳ͍ʂ • Πϝʔδʹඞཁͳͷ͚ͩΛೖΕΑ͏ • ىಈߴԽɺӡ༻ޮԽɺϦεΫܰݮ • Cloud RunΫιศརɻGCP৴ऀʹͳΔΘɻ