Location via proxy:
[ UP ]
[Report a bug]
[Manage cookies]
No cookies
No scripts
No ads
No referrer
Show this form
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
970
Container Build Talk
orisano
3
2.5k
Better docker image+
orisano
6
5.9k
Socket.IO Introduction
orisano
0
3.1k
Profiling Go Application
orisano
11
7.7k
Multi-stage Builds Patterns & Practice
orisano
6
5k
better docker image
orisano
22
30k
the world of characters
orisano
8
1.4k
Other Decks in Programming
See All in Programming
カンファレンス動画鑑賞会のススメ / Osaka.swift #1
hironytic
0
200
社内フレームワークとその依存性解決 / in-house framework and its dependency management
vvakame
1
490
Amazon Bedrock Multi Agentsを試してきた
tm2
1
210
『改訂新版 良いコード/悪いコードで学ぶ設計入門』活用方法−爆速でスキルアップする!効果的な学習アプローチ / effective-learning-of-good-code
minodriven
29
4.8k
2,500万ユーザーを支えるSREチームの6年間のスクラムのカイゼン
honmarkhunt
6
4k
いりゃあせ、PHPカンファレンス名古屋2025 / Welcome to PHP Conference Nagoya 2025
ttskch
1
240
CNCF Project の作者が考えている OSS の運営
utam0k
5
610
Pythonでもちょっとリッチな見た目のアプリを設計してみる
ueponx
0
200
Fixstars高速化コンテスト2024準優勝解法
eijirou
0
200
[JAWS-UG横浜 #80] うわっ…今年のServerless アップデート、少なすぎ…?
maroon1st
0
140
Alba: Why, How and What's So Interesting
okuramasafumi
0
240
個人アプリを2年ぶりにアプデしたから褒めて / I just updated my personal app, praise me!
lovee
0
300
Featured
See All Featured
CoffeeScript is Beautiful & I Never Want to Write Plain JavaScript Again
sstephenson
160
15k
The World Runs on Bad Software
bkeepers
PRO
67
11k
GitHub's CSS Performance
jonrohan
1030
460k
Automating Front-end Workflow
addyosmani
1367
200k
Music & Morning Musume
bryan
46
6.3k
Building an army of robots
kneath
302
45k
Learning to Love Humans: Emotional Interface Design
aarron
274
40k
A Modern Web Designer's Workflow
chriscoyier
693
190k
Dealing with People You Can't Stand - Big Design 2015
cassininazir
365
25k
YesSQL, Process and Tooling at Scale
rocio
171
14k
VelocityConf: Rendering Performance Case Studies
addyosmani
327
24k
Six Lessons from altMBA
skipperchong
27
3.6k
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 -