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
dockerignore talk
Search
orisano
May 13, 2019
Programming
2
7k
dockerignore talk
orisano
May 13, 2019
Tweet
Share
More Decks by orisano
See All by orisano
OSS Performance Tuning Tips
orisano
8
5.6k
Docker-Compose & BuildKit
orisano
4
960
Container Build Talk
orisano
3
2.4k
Better docker image+
orisano
6
5.9k
Socket.IO Introduction
orisano
0
3k
Profiling Go Application
orisano
11
7.6k
Multi-stage Builds Patterns & Practice
orisano
6
5k
better docker image
orisano
22
30k
the world of characters
orisano
8
1.3k
Other Decks in Programming
See All in Programming
Go の GC の不得意な部分を克服したい
taiyow
2
770
良いユニットテストを書こう
mototakatsu
5
1.9k
rails stats で紐解く ANDPAD のイマを支える技術たち
andpad
1
290
range over funcの使い道と非同期N+1リゾルバーの夢 / about a range over func
mackee
0
110
Full stack testing :: basic to basic
up1
1
930
生成AIでGitHubソースコード取得して仕様書を作成
shukob
0
300
Zoneless Testing
rainerhahnekamp
0
120
たのしいparse.y
ydah
3
120
htmxって知っていますか?次世代のHTML
hiro_ghap1
0
330
今からはじめるAndroidアプリ開発 2024 / DevFest 2024
star_zero
0
1k
CSC305 Lecture 25
javiergs
PRO
0
130
今年一番支援させていただいたのは認証系サービスでした
satoshi256kbyte
1
250
Featured
See All Featured
Fashionably flexible responsive web design (full day workshop)
malarkey
405
66k
Making Projects Easy
brettharned
116
5.9k
VelocityConf: Rendering Performance Case Studies
addyosmani
326
24k
Fontdeck: Realign not Redesign
paulrobertlloyd
82
5.3k
Being A Developer After 40
akosma
87
590k
A Tale of Four Properties
chriscoyier
157
23k
Responsive Adventures: Dirty Tricks From The Dark Corners of Front-End
smashingmag
251
21k
The Psychology of Web Performance [Beyond Tellerrand 2023]
tammyeverts
45
2.2k
Making the Leap to Tech Lead
cromwellryan
133
9k
Imperfection Machines: The Place of Print at Facebook
scottboms
266
13k
GitHub's CSS Performance
jonrohan
1030
460k
A Philosophy of Restraint
colly
203
16k
Transcript
dockerignoreͷ Container Build Meetup #2 #container_build @orisano
docker buildͷΛ͠·͢
%PDLFS$-* EPDLFSE
%PDLFS$-* EPDLFSE $ docker build .
%PDLFS$-* EPDLFSE $ docker build [build context]
%PDLFS$-* EPDLFSE $ docker build . 1. build contextΛtarͰarchive͢Δ
%PDLFS$-* EPDLFSE $ docker build . 2. dockerdʹରͯ͠POST͢Δ
%PDLFS$-* EPDLFSE $ docker build . 3. ड͚औͬͨtarΛల։
%PDLFS$-* EPDLFSE $ docker build . 4. DockerfileͷղऍΛ͢Δ
%PDLFS$-* EPDLFSE $ docker build . 5. εςʔδ͝ͱʹ࣮ߦ
%PDLFS$-* EPDLFSE $ docker build . 6. InstructionΛ࣮ߦ
%PDLFS$-* EPDLFSE $ docker build . 7. Instructionຖʹimage͕Ͱ͖Δ
%PDLFS$-* EPDLFSE $ docker build . 8.ऴΘͬͨΒ௨
ෆཁͳϑΝΠϧ build contextʹؚΊͨ͘ͳ͍
ͳͥʁ
1. Archiveͷίετ 2. సૹͷίετ 3. cacheͷͨΊ
1. Archiveͷίετ 2. సૹͷίετ 3. cacheͷͨΊ
େྔͷϑΝΠϧΛ ΞʔΧΠϒ͢Δͷॏ͍ (node_modulesͳͲ)
ΫϥΠΞϯτଆͰߦ͏͕ ݱঢ়̎ͭͷ࣮͕͋Δ
docker/cli (Go) docker/docker-py (Python)
docker/cli (Go) dockerίϚϯυ
docker/docker-py (Python)
Docker Engine APIΛ Python͔Β͏ͨΊͷͷ docker/compose ͕͍ͬͯΔ ͳΜ͔͍
AntiVirusͳͲ͕ I/OΛhook͍ͯ͠Δ߹ I/Oίετ͕͍
1. Archiveͷίετ 2. సૹͷίετ 3. cacheͷͨΊ
େ͖ͳϑΝΠϧΛૹΔͷ େม
1. Archiveͷίετ 2. సૹͷίετ 3. cacheͷͨΊ
COPYͰ ҙਤͯ͠ͳ͍ϑΝΠϧ͕ ରʹͳ͍ͬͯΔͱ cache͕յΕͯ࠷ѱ
build contextʹ ؚΊ͍͚ͯͳ͍ϑΝΠϧ ͕͋Δ
1. ೝূใ 2. ΞʔΩςΫνϟґଘ
1. ೝূใ 2. ΞʔΩςΫνϟґଘ
ݴΘ͕ͣͳ .envͳͲ
.git͕ةݥͳ߹͋Δ personal tokenͰͷ git cloneΛ͍ͯ͠ΔͳͲ
1. ೝূใ 2. ΞʔΩςΫνϟґଘ
package managerʹΑΔ͕ ͦͷڥ͚ͷbuildࡁΈ όΠφϦ͕͓͍ͯ͋Δ͜ͱ͕ (npm)
Ҏ্ͷΛղܾ͢ΔͨΊʹ dockerignore Λ͏
dockerignore
ޙΖʹॻ͍ͯ͋Δ pattern͕༏ઌ͞ΕΔ ઌ಄ʹ!Λ͚ͭΔͱ൱ఆͰ͖Δ
͑Δදه foo/* foo/** foo/?
෦Ͱ ਖ਼نදݱʹม͍ͯ͠Δ
ਖ਼نදݱͳΒΘ͔Δ ͱ͍͏ਓ͚ʹ github.com/orisano/dire
ରԠ͢Δਖ਼نදݱΛग़ྗ
Ͳ͏࣮ͬͯݱ͍ͯ͠Δ͔
%PDLFS$-* EPDLFSE $ docker build . 1. build contextΛtarͰarchive͢Δ
%PDLFS$-* EPDLFSE $ docker build . 0. build contextͷҎԼͷϑΝΠϧ͕readՄೳ͔֬ೝ (͜͜dockerignoreΛߟྀ͞ΕΔ)
%PDLFS$-* EPDLFSE $ docker build . 0.5. directoryΛtraverse͠ͳ͕Βdockerignoreʹ Ϛον͠ͳ͍ϑΝΠϧΛtarʹՃ͍ͯ͘͠
%PDLFS$-* EPDLFSE $ docker build . 1. build contextΛtarͰarchive͢Δ
༨ஊ
%PDLFS$-* EPDLFSE $ docker build . 0. build contextͷҎԼͷϑΝΠϧ͕readՄೳ͔֬ೝ (͜͜dockerignoreΛߟྀ͞ΕΔ)
ϑΝΠϧdockerignore͕ ίϯύΠϧ͞ΕΔΑ͏ʹ ͳ͍ͬͯͨ
docker/cli/pull/1577 Ͱमਖ਼͞Ε Docker 19.03 ͔ΒೖΓ·͢
ͪΐͬͱಛघͳྫ
monorepoͰ subsystemؒͷґଘ͕͋Δ ߹
େຊΛbuild contextʹ ͠ͳ͍ͱ͍͚ͳ͘ͳΔ
build context͕Ͱ͔͘ͳΔ
dockerignoreͰղܾ! ͢Δ͜ͱͰ͖ͳ͍
dockerignorebuildຖʹ ϑΝΠϧΛࢦఆͰ͖ͳ͍
subsystemຖʹ dockerignoreΛ࡞Γ buildͷͨͼʹ dockerignoreΛࣗಈੜ͢Δ Ξϓϩʔν͕༗ޮ
github.com/orisano/dignore
Α͋͘Δ
gitignoreͱdockerignore ͕ ΄΅ҰॹʹͳΔ
ͦ͏͍͏߹ʹ dockerignore ͍Βͳ͘ͳΔํ๏͕͋Δ
git archiveͬͯ ίϚϯυͬͨ͜ͱ͋Γ·͔͢
repositoryΛtarʹͰ͖Δ ίϚϯυ
tarʹ͢ΕbuildͰ͖ΔͷͰ
git archive HEAD | docker build -