Let's use buildkit!

Ad22fcf5773b906c08330f4d57242212?s=47 Kohei Ota
September 03, 2018

Let's use buildkit!

Ad22fcf5773b906c08330f4d57242212?s=128

Kohei Ota

September 03, 2018
Tweet

Transcript

  1. BuildKitΛ࢖ͬͯΈΑ͏ʂ Presented by @_inductor_

  2. Who am I? • inductor(@_inductor_) • Cloud(AWS)/DevOps Engineer
 @ Start

    Today Technologies, Inc. • Admin @ Πϯϑϥษڧձ • DevOps / Containeriation / CI/CD Pipelines • Japan Container Daysελοϑ΍ͬͯ·͢
  3. ͋ͱʹͳͬͯؾ͍ͮͨͷͰ͕͢ɺલճͷ MeetupͰਢా͞Μ͕࿩ͨ͠಺༰ͷ΄΅
 ϦόΠζʢ͔͠΋ΏΔ;Θ൛ʣͰͨ͠ʼʻ LTͳͷͰ·ͬͨΓௌ͍͍ͯͩ͘͞

  4. What is BuildKit?

  5. BuildKit • Moby project͕ओମͱͳͬͯ։ൃ͍ͯ͠ΔOSS • DockerfileΛΠϝʔδʹbuild͢ΔͨΊͷϏϧυπʔϧ • GoݴޠͰ։ൃ͞Ε͍ͯΔ • ݱࡏ͸ϓϨϏϡʔͷஈ֊

  6. BuildKitͷ͍͢͝ͱ͜Ζ • ฒྻ࣮ߦ͕͔͍͜͠ • Multi-stage build͕ฒྻ࣮ߦ͞ΕΔʢʂʂʂʣ • Ωϟογϡ͕͔͍͜͠ • ෳ਺ΞʔΩςΫνϟ޲͚ͷϏϧυ͕࡞ΕΔ

    • ࠓ·ͰͷDockerfile΋ී௨ʹಈ͘(͸ͣ) • ৄ͘͠͸ਢా͞ΜͷεϥΠυ΍ެࣜϦϙδτϦࢀর
  7. Multi-stage buildΛ
 ஌ͬͯΔΑͬͯਓ
 खڍ͍͛ͯͩ͘͞ʂ

  8. Multi-stage buildΛ
 ࢖ͬͯΔΑͬͯਓ
 खڍ͍͛ͯͩ͘͞ʂ

  9. Multi-stage build? • ಉҰDockerfile಺Ͱෳ਺ͷΠϝʔδΛ࡞੒Ͱ͖Δػೳ • ΋ͬͱ͍͏ͱ్தͰίϯύΠϧͨ͠ϑΝΠϧ͚ͩΛϝΠϯ ͷΠϝʔδʹࡌͤͨΓͰ͖Δ(ίϯύΠϧݴޠͰهड़͞Εͨ ϓϩδΣΫτ(ྫ͑͹goͱ͔)ͩͱ࣮ߦϑΝΠϧ΍Ұ෦ͷઃ ఆϑΝΠϧҎ֎ɺ࣮ߦ؀ڥͰ͸͍Βͳ͍ΑͶʁͱ͔) •

    Ϗϧυͷ݁ՌͰ͖ͨ੒Ռ෺͚ͩΛίϯςφΠϝʔδͱͯ͠ ࡌͤΔ͜ͱ͕ग़དྷΔ • ෆཁϑΝΠϧ෼͚ͩαΠζ͕ݮΔʂ
  10. DockerͰBuildKit • Docker CEͰࢼ͢৔߹ • Nightly·ͨ͸TestνϟϯωϧͰCEΛೖΕΔ
 (چEdgeνϟϯωϧ) • MacɺWindowsͷ৔߹͸EdgeΛ࢖͏ •

    ؀ڥม਺ʹ `export DOCKER_BUILDKIT=1` Ληοτ
  11. σϞ
 (͕࣌ؒͳ͔ͬͨΒεΩοϓ)

  12. खݩͰࢼͨ݁͠Ռ firebase cliͱhugoίϚϯυΛೖΕΔDockerfile

  13. खݩͰࢼͨ݁͠Ռ GoݴޠͰhello worldίϯύΠϧͯ͠ೖΕΔDockerfile

  14. ·ͱΊ • ฒྻͰ࣮ߦ͢ΔϏϧυ͕Ұഋ͋ΔͳΒ࢖ͬͯΈ·͠ΐ͏ʂ • ࠓ·Ͱ͸αΠζݮ͚ͩͩͬͨMulti-stage buildͷϝϦοτ͕
 ଎౓ʹ΋Өڹͯ͘͠ΔΑ͏ʹͳΔ • ଎͘ͳΔ༨஍ͷ͋ΔDockerfile͕͋Γͦ͏ͩͬͨΒ
 ࠓޙͷͨΊʹಋೖͯ͠ΈͨΒ͍͍ͷͰ͸ʂ

    • Docker composeͰ͸·ͩ࢖͑ͳ͍ • K8sͰ࢖͏৔߹͸KnativeͷBuild TemplatesʹBuildKitΛ௥Ճ͢Δ
 ඞཁ͕͋ΔΒ͍͠
  15. ͓ΘΓ