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
Karn Wong
November 01, 2023
Technology
120
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
27
Global Azure 2026 - Securing VM Access On Azure
kahnwong
0
61
AgentCon Bangkok 2026 - How to Stay Sane in the Age of Agents
kahnwong
0
95
National Coding Day 2026 - Software Evolution: The Complete Lifecycle
kahnwong
0
91
Microsoft Ignite After Party 2025 - Azure Infrastructure for Cloud Native Solutions
kahnwong
0
66
AI Community Day Bangkok 2025 - In-Browser ML/LLM Inference Ecosystem
kahnwong
0
83
Data & AI Day 2025 - You Created a Pipeline, Now What?
kahnwong
0
140
Pycon Thailand 2025 - ML Model Serving Optimization with ONNX
kahnwong
0
81
MFEC x Google Cloud Thailand: Betagro Bootcamp - IaC Adoption
kahnwong
0
93
Other Decks in Technology
See All in Technology
AIを活用するために決めた "やらないこと" - 価値に注目する / Not betting on AI
soudai
PRO
1
260
OpenTelemetryのメトリクスをCloudWatchに送ってPromQLで見てみた
ota1022
0
130
DEFCON34-Write-up_HYCu-MYCu
daikiokazaki
0
150
10Xに技術的負債をもたらした「2つの境界の歪み」その構造と解消への営み
10xinc
0
590
2026-09-09 【sigma_ucj#1】Sigma を IaC 管理したい! / IaC for Sigma
civitaspo
0
120
Deploying a Full-Stack Bun-Native Framework on Cloudflare Workers
7nohe
0
150
2026/09/10 Spring Bootから Jakarta EE/MicroProfileへの移行
megascus
0
350
コスト最適化の「めんどくさい」を AWS FinOps Agent でチョット楽にする
classmethod_kaz
0
330
AI 駆動 Terraform 開発/SRE_BizReach_MIXI_2
visional_engineering_and_design
5
2.1k
フルカイテン株式会社 エンジニア向け採用資料
fullkaiten
0
12k
研究開発部の紹介 / Sansan R&D Profile
sansan33
PRO
5
25k
Screen Lens - 今見てる画面を翻訳する
komagata
0
260
Featured
See All Featured
Side Projects
sachag
456
43k
The AI Search Optimization Roadmap by Aleyda Solis
aleyda
1
6.2k
The State of eCommerce SEO: How to Win in Today's Products SERPs - #SEOweek
aleyda
2
12k
Odyssey Design
rkendrick25
PRO
2
800
SEO for Brand Visibility & Recognition
aleyda
0
4.7k
The Invisible Side of Design
smashingmag
301
52k
Stop Working from a Prison Cell
hatefulcrawdad
274
21k
Being A Developer After 40
akosma
91
590k
Digital Projects Gone Horribly Wrong (And the UX Pros Who Still Save the Day) - Dean Schuster
uxyall
1
2.8k
End of SEO as We Know It (SMX Advanced Version)
ipullrank
3
4.4k
Evolution of real-time – Irina Nazarova, EuRuKo, 2024
irinanazarova
9
1.5k
A Modern Web Designer's Workflow
chriscoyier
699
190k
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!