Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
docker-multi-stage-build
Search
Hirokazu Maruta
July 30, 2019
Technology
0
140
docker-multi-stage-build
dockerのマルチステージビルドについて登壇しました。
Lightning talk of docker and docker-multi-stage-build.
Hirokazu Maruta
July 30, 2019
Tweet
Share
More Decks by Hirokazu Maruta
See All by Hirokazu Maruta
encryption
mochisuna
0
94
わかった気になるチューリングマシン
mochisuna
0
38
Elementary algorithm
mochisuna
0
17
ssh-dynamic-forward
mochisuna
0
46
ServerlessFramework-Trello
mochisuna
0
26
TechBash Slack Reaction Award
mochisuna
0
43
techbash-clasp
mochisuna
0
54
vuejs-night-publish
mochisuna
0
840
surprise-lt-for-intern-vol-2
mochisuna
0
49
Other Decks in Technology
See All in Technology
SDN の Hype Cycle を一通り経験してみて思うこと / Going through the Hype Cycle of SDN
mshindo
3
290
DynamoDB でスロットリングが発生したとき/when_throttling_occurs_in_dynamodb_short
emiki
0
310
セキュリティベンダー/ユーザー双方の視点で語る、 Attack Surface Managementの実践 - Finatextパート / cloudnative-architecture-of-asm
stajima
0
1.2k
CysharpのOSS群から見るModern C#の現在地
neuecc
2
4.1k
minify の効果を最大限に引き出す TypeScript コードを書く
jsakamoto
2
120
TypeScriptの次なる大進化なるか!? 条件型を返り値とする関数の型推論
uhyo
2
1.8k
The Rise of LLMOps
asei
10
2.1k
個人でもIAM Identity Centerを使おう!(アクセス管理編)
ryder472
4
260
RAMP2024
takeyukitamura
1
120
電話を切らさない技術 電話自動応答サービスを支える フロントエンド
barometrica
2
1.4k
SSMRunbook作成の勘所_20241120
koichiotomo
3
190
A Tour of Anti-patterns for Functional Programming
guvalif
0
1.8k
Featured
See All Featured
Raft: Consensus for Rubyists
vanstee
136
6.6k
I Don’t Have Time: Getting Over the Fear to Launch Your Podcast
jcasabona
28
2k
Designing on Purpose - Digital PM Summit 2013
jponch
115
7k
A Philosophy of Restraint
colly
203
16k
Building a Scalable Design System with Sketch
lauravandoore
459
33k
jQuery: Nuts, Bolts and Bling
dougneiner
61
7.5k
Java REST API Framework Comparison - PWX 2021
mraible
PRO
28
8.2k
Large-scale JavaScript Application Architecture
addyosmani
510
110k
ピンチをチャンスに:未来をつくるプロダクトロードマップ #pmconf2020
aki_iinuma
111
49k
The Invisible Side of Design
smashingmag
298
50k
Designing Dashboards & Data Visualisations in Web Apps
destraynor
229
52k
Put a Button on it: Removing Barriers to Going Fast.
kastner
59
3.5k
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৴ऀʹͳΔΘɻ