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
6.9k
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
950
Container Build Talk
orisano
3
2.4k
Better docker image+
orisano
6
5.8k
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
Amazon Bedrock Agentsを用いてアプリ開発してみた!
har1101
0
320
Webの技術スタックで マルチプラットフォームアプリ開発を可能にするElixirDesktopの紹介
thehaigo
2
1k
TypeScript Graph でコードレビューの心理的障壁を乗り越える
ysk8hori
1
630
Googleのテストサイズを活用したテスト環境の構築
toms74209200
0
310
3rd party scriptでもReactを使いたい! Preact + Reactのハイブリッド開発
righttouch
PRO
1
600
Make Impossible States Impossibleを 意識してReactのPropsを設計しよう
ikumatadokoro
0
150
Click-free releases & the making of a CLI app
oheyadam
2
110
イベント駆動で成長して委員会
happymana
1
300
みんなでプロポーザルを書いてみた
yuriko1211
0
240
Identifying User Idenity
moro
6
9.8k
リアーキテクチャxDDD 1年間の取り組みと進化
hsawaji
1
200
Tauriでネイティブアプリを作りたい
tsucchinoko
0
360
Featured
See All Featured
No one is an island. Learnings from fostering a developers community.
thoeni
19
3k
Bootstrapping a Software Product
garrettdimon
PRO
305
110k
Ruby is Unlike a Banana
tanoku
96
11k
The Cult of Friendly URLs
andyhume
78
6k
Bash Introduction
62gerente
608
210k
5 minutes of I Can Smell Your CMS
philhawksworth
202
19k
Evolution of real-time – Irina Nazarova, EuRuKo, 2024
irinanazarova
4
370
Intergalactic Javascript Robots from Outer Space
tanoku
269
27k
ピンチをチャンスに:未来をつくるプロダクトロードマップ #pmconf2020
aki_iinuma
109
49k
Measuring & Analyzing Core Web Vitals
bluesmoon
3
90
GitHub's CSS Performance
jonrohan
1030
460k
Keith and Marios Guide to Fast Websites
keithpitt
409
22k
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 -