Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Sign up for free
Menu
Search
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Pricing
Search
Sign in
Sign up for free
GitHub Universe After Party Thailand 2023 - Fas...
Search
Sponsored
·
Ship Features Fearlessly
Turn features on and off without deploys. Used by thousands of Ruby developers.
→
Karn Wong
November 01, 2023
Technology
130
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
GitHub Universe After Party Thailand 2023 - Faster deployments with multi-stage build caching
Karn Wong
November 01, 2023
More Decks by Karn Wong
See All by Karn Wong
Python Developer Day 2026 - Demystifying Agent Sandbox
kahnwong
0
47
Global Azure 2026 - Securing VM Access On Azure
kahnwong
0
71
AgentCon Bangkok 2026 - How to Stay Sane in the Age of Agents
kahnwong
0
100
National Coding Day 2026 - Software Evolution: The Complete Lifecycle
kahnwong
0
96
Microsoft Ignite After Party 2025 - Azure Infrastructure for Cloud Native Solutions
kahnwong
0
75
AI Community Day Bangkok 2025 - In-Browser ML/LLM Inference Ecosystem
kahnwong
0
91
Data & AI Day 2025 - You Created a Pipeline, Now What?
kahnwong
0
150
Pycon Thailand 2025 - ML Model Serving Optimization with ONNX
kahnwong
0
89
MFEC x Google Cloud Thailand: Betagro Bootcamp - IaC Adoption
kahnwong
0
99
Other Decks in Technology
See All in Technology
TinyGoでオブザーバビリティ?OpenTelemetryはTinyGoで使えるのか / Is OpenTelemetry available in TinyGo environment?
ymotongpoo
2
140
脆弱性診断って、何をしているの? 〜弱点を見つけて、会社の改善につなげるまで〜
keeg
0
920
1つのリクエストを追って理解する - llm-dのP/D分離
akhino
1
160
その Valkey 使いこなしていますか?
onk
PRO
5
1.5k
AI × アーキテクト 第1・2章|生成AIの課題とアーキテクトの素養
daidaidai
0
170
M5Stackで作る BLEマウス GPSログの世界
tomokusaba
0
420
Claude Code本は、どのように執筆チームで書かれたか
oikon48
1
380
パッチ更新でterraform initが落ちた日
grimoh
1
140
AI駆動開発の時代になったのでトヨタ生産方式から見直す
terurou
7
6k
Gemini Intelligence 入門 ― AppFunctions と Gemini Nano
takuroabe
0
250
AIにシークレットを見せない、WSL2で安全な開発環境
yazm
0
300
子育てエンジニアの可処分時間が減っても成長を諦めない戦い方
sudoakiy
6
4.6k
Featured
See All Featured
30 Presentation Tips
portentint
PRO
1
430
Hiding What from Whom? A Critical Review of the History of Programming languages for Music
tomoyanonymous
3
1.3k
The Limits of Empathy - UXLibs8
cassininazir
2
720
Git: the NoSQL Database
bkeepers
PRO
433
67k
Evolution of real-time – Irina Nazarova, EuRuKo, 2024
irinanazarova
9
1.6k
VelocityConf: Rendering Performance Case Studies
addyosmani
331
25k
Product Roadmaps are Hard
iamctodd
55
13k
Building Applications with DynamoDB
mza
96
7.2k
Fight the Zombie Pattern Library - RWD Summit 2016
marcelosomers
234
18k
Designing for Performance
lara
612
70k
Mobile First: as difficult as doing things right
swwweet
225
10k
Java REST API Framework Comparison - PWX 2021
mraible
34
9.8k
Transcript
Faster deployments with multi- stage build caching Here’s to incremental
deployments.
About me kahnwong Karnsiree Wong karnwong.me Head of Platform Engineering
@Baania Often known as DevSecMLFinDataOps Faster deployments -> Faster iterations I love automation
CI/CD workflow
Dockerfile FROM node:18 WORKDIR /opt/build COPY package.json . COPY yarn.lock
. RUN yarn install COPY . . RUN yarn build EXPOSE 3000 CMD [ "yarn", "start", "-H", "0.0.0.0" ]
GitHub Actions Buildx - name: Build and tag image uses:
docker/build-push-action@v5 with: context: . builder: ${{ steps.buildx.outputs.name }} file: Dockerfile push: true tags: ${{ steps.meta.outputs.tags }} provenance: false
But we can cache docker layers
GitHub Actions Buildx with cache - name: Build and tag
image uses: docker/build-push-action@v5 with: context: . builder: ${{ steps.buildx.outputs.name }} file: Dockerfile push: true cache-from: type=gha # add this cache-to: type=gha,mode=max # add this tags: ${{ steps.meta.outputs.tags }} provenance: false
Buildx Buildx with cache
How do we know that we’re using cache?
Check GitHub Actions caches from all workflows
What about image size?
Dockerfile with multi-stage build # --------------- builder --------------- # FROM
node:18 AS builder WORKDIR /opt/build COPY package.json . COPY yarn.lock . RUN yarn install COPY . . RUN yarn build # --------------- package --------------- # FROM node:18-alpine AS deploy WORKDIR /app COPY --from=builder /opt/build/.next ./.next COPY --from=builder /opt/build/node_modules ./node_modules COPY --from=builder /opt/build/public ./public COPY --from=builder /opt/build/next.config.js ./ COPY --from=builder /opt/build/package.json ./ EXPOSE 3000 CMD [ "yarn", "start", "-H", "0.0.0.0" ]
Why multi-stage build? yarn build creates a lot of temporary
files We don’t need those "temporary files" for yarn start ` ` ` `
Let’s guess the image size!
Normal build Multi-stage build
How much can we save? Build time 30s per build
(from 3m24s to 2m57s) Image storage (compressed) 300MB per image (from 450MB to 150MB)
Any questions?
Ready for cost reduction? If we deploy 150 times /
month
Cost breakdown Service No Cache With Cache GitHub Actions (Runtime)
3m24s * 150 = 510m 2m57s * 150 = 442.5m Service Normal Build Multi-Stage Build ECR (Storage) 450MB * 150 = 66GB 150MB * 150 = 22GB ECR (Cost) 150MB * 150 = 22GB 22GB * 0.10 USD = 2.2 USD In total, we can save 67.5 minutes and 4.4 USD per month.
I know you love pretty charts
GitHub Actions Cache can also be used with runtimes steps:
- uses: actions/checkout@v4 - uses: actions/setup-node@v4 with: node-version: 18 cache: 'yarn' - run: yarn install - run: yarn build
Let’s revisit CI/CD workflow again
Any questions?
Summary GitHub Actions cache can be used with docker image
build and setup actions Multi-stage build can drastically reduce image size (in turn, reducing image storage cost) These lead to faster CI/CD run time and faster deployments During PR review, automated checks can be done faster as well
Check out the slides and repo!