Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Docker bake(とCache)でCI/CDを改善する

Docker bake(とCache)でCI/CDを改善する

ゆるゆる

January 22, 2024
Tweet

More Decks by ゆるゆる

Other Decks in Programming

Transcript

  1. 7 CBLFͷϝϦοτ • ࠷దͳϏϧυॱΛܭࢉͯ͠ϏϧυΛߦͬͯ͘ΕΔ • Ϗϧυͷॲཧޮ཰্͕͕Δ ϨΠϠʔ̍ ϨΠϠʔ̎ ϨΠϠʔ̏ λʔήοτ"

    ϨΠϠʔ̍ ϨΠϠʔ̎ λʔήοτ# ϨΠϠʔ̐ ϨΠϠʔ̍ ϨΠϠʔ̎ ϨΠϠʔ̏ λʔήοτ" λʔήοτ# ϨΠϠʔ̐ ˞͜ͷॏෳ࡟আ͸ CVJME,JUͷػೳ
  2. 8 CBLFͷϝϦοτ • ϏϧυઃఆΛߏ଄తʹఆٛͰ͖Δ • )$- )BTIJ$PSQDPOGJHVSBUJPOMBOHVBHF ͕࢖͑Δ https://github.com/moby/buildkit/blob/master/docker-bake.hcl#L118-L148 variable

    "GO_VERSION" { default = null } ม਺ function "bindir" { params = [defaultdir] result = DESTDIR != "" ? DESTDIR : "./bin/${defaultdir}" } ؔ਺ name = "lint-${buildtags.name}" จࣈͷຒΊࠐΈʢςϯϓϨʔτϦςϥϧʣ
  3. 11 ͱ͋ΔϓϩδΣΫτͷ࿩ • &$4Ͱ "1*αʔόʔ͕ߏங͞Ε͍ͯΔ • ݕূ༻ؚΊ໿ݸͷΠϝʔδΛϏϧυ͢Δඞཁ͕͋Δ • $*$%͸ +FOLJOTΛར༻͍ͯͨ͠

    ◦ ؀ڥ͸ $*͝ͱʹϦηοτ͞Εͳ͍ ◦ উखʹ %PDLFSͷ MBZFSDBDIF͕ޮ͘ͷ͸ϝϦοτͱ΋ݴ͑ͳ͘΋ͳ͍ʢͳ͍ʣ • σϓϩΠઌ͕ΊͪΌͪ͘Ό͋Δʂ • ຊ൪؀ڥ΁ͷσϓϩΠ΋ࣗಈԽ͍ͯͯ͠ɺόʔδϣϯλάΛ෇͚Δʢ͜Ε΋ϫʔΫϑϩ ʔΛ༻ҙ͍ͯ͠·͢ʣ͚ͩͰσϓϩΠ͞ΕΔ • (JU)VC"DUJPOTʹҠߦ͢Δ
  4. 12 ํ਑ • $*$%ͷྲྀΕ͸͋·Γ͍͡Βͳ͍ • (JU)VC"DUJPOT͸ຖճ؀ڥ͕Ϧηοτ͞ΕΔͷͰɺผͷ৔ॴʹ MBZFS DBDIF Λอଘ͢Δ ◦

    ࠓճ͸ 4Λબͼ·ͨ͠ ◦ ͜ͷΩϟογϡͷهड़͕ΊͪΌͪ͘Ό௕͍ͷͰ CBLFͷԸܙ͕ग़͖ͯ·͢
  5. 13 +FOLJOT࣌୅ͷϏϧυ࣌ؒ • UYMBSHFʢDPSF(#ʣ • ෼ʙ෼͘Β͍ ◦ " # ͸ฒྻͰ͢

    • গͳ͘ͱ΋ :BSOͷΩϟογϡ͕ޮ͘͸ͣ Ͱ͕͢ɺͳ͔ͥ ճ໨΋ಉ͡Α͏ͳ࣌ؒ ͔͔͍ͬͯΔ ビルドA ビルドB 2回目 3回目 1回目