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
93
Elementary algorithm
mochisuna
0
37
ssh-dynamic-forward
mochisuna
0
75
ServerlessFramework-Trello
mochisuna
0
43
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
子育てエンジニアの可処分時間が減っても成長を諦めない戦い方
sudoakiy
6
4.6k
Local CI × GitHub Actions
gogutan
2
190
[JAWS-UG彩の国埼玉#12]そろそろ準備する?re:Invent2026をやさしく解説 / reinvent2026-sainokuni
sh_fk2
1
340
宣言型部分更新は何を解決しどこへ向かうのか
shuta13
1
450
DevelopersIO 2026 知識の地図を描く ─ オントロジーとは何か?
ishikawa_satoru
1
1.7k
Running Kotlin + Quarkus with Lambda
nealle
1
3.7k
QA4AI 2026-Oct 生成AI時代の品質保証
tokuty
1
860
AI駆動で「他アプリの音を加工できる」アプリを作った
satomasahiro2005
0
150
20261017福岡devIO 「AIは"良いダッシュボード"を作れるか?
jtakeda
0
140
事業成長とデータ活用を止めないためのマネジメントへ挑戦
hiracky16
0
390
LambdaWebFunctionsを試してみた / exploring-lambda-web-functions
koukihosaka
1
340
WasmをRustにする
sansantech
PRO
0
250
Featured
See All Featured
Future Trends and Review - Lecture 12 - Web Technologies (1019888BNR)
signer
PRO
0
3.8k
Agile Actions for Facilitating Distributed Teams - ADO2019
mkilby
0
310
The Straight Up "How To Draw Better" Workshop
denniskardys
239
140k
Paper Plane
katiecoart
PRO
5
54k
Pawsitive SEO: Lessons from My Dog (and Many Mistakes) on Thriving as a Consultant in the Age of AI
davidcarrasco
0
260
Paper Plane (Part 1)
katiecoart
PRO
2
12k
Code Review Best Practice
trishagee
74
20k
<Decoding/> the Language of Devs - We Love SEO 2024
nikkihalliwell
1
360
How to build a perfect <img>
jonoalderson
1
6.1k
WENDY [Excerpt]
tessaabrams
14
40k
The Cult of Friendly URLs
andyhume
79
7k
Visual Storytelling: How to be a Superhuman Communicator
reverentgeek
2
710
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৴ऀʹͳΔΘɻ