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
GitHub Universe After Party Thailand 2023 - Fas...
Search
Sponsored
·
SiteGround - Reliable hosting with speed, security, and support you can count on.
→
Karn Wong
November 01, 2023
Technology
110
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
Global Azure 2026 - Securing VM Access On Azure
kahnwong
0
48
AgentCon Bangkok 2026 - How to Stay Sane in the Age of Agents
kahnwong
0
74
National Coding Day 2026 - Software Evolution: The Complete Lifecycle
kahnwong
0
83
Microsoft Ignite After Party 2025 - Azure Infrastructure for Cloud Native Solutions
kahnwong
0
49
AI Community Day Bangkok 2025 - In-Browser ML/LLM Inference Ecosystem
kahnwong
0
66
Data & AI Day 2025 - You Created a Pipeline, Now What?
kahnwong
0
130
Pycon Thailand 2025 - ML Model Serving Optimization with ONNX
kahnwong
0
67
MFEC x Google Cloud Thailand: Betagro Bootcamp - IaC Adoption
kahnwong
0
77
{{Ops}Ver.se - Infrastructure as Code and Business Value
kahnwong
0
120
Other Decks in Technology
See All in Technology
最近評価が難しくなった
maroon8021
0
260
Kotlin 開発のツラミを爆破した話! / Explode the difficulty of Kotlin dev!
eller86
0
150
End-to-Endで考える信頼性 —LINEアプリにおけるクライアント開発×SRE連携の実践
maruloop
4
3.3k
Compose 新機能総まとめ / What's New in Jetpack Compose
yanzm
0
150
認証認可だけじゃない! ID管理の構成要素と ライフサイクルを意識しよう
ritou
1
530
20260702_生成AIはどこまで成長するのか_チャットだけじゃない世界
doradora09
PRO
0
110
そのタスクオンスケですか?
poropinai1966
0
140
記録をかんたんに、提案をパーソナルに ── AIであすけんが目指すもの
oprstchn
0
170
ループエンジニアリングでE2Eテストを実践
noriyukitakei
0
310
AWS Blocks を触ってみた/first-tach-aws-blocks
fossamagna
2
150
Zoom2Youtube.Claude
kawaguti
PRO
3
470
FinOps X 2026 Recap from Engineer Side #JapanFinOps
chacco38
0
270
Featured
See All Featured
Designing for humans not robots
tammielis
254
26k
Helping Users Find Their Own Way: Creating Modern Search Experiences
danielanewman
31
3.2k
How GitHub (no longer) Works
holman
316
150k
How to Talk to Developers About Accessibility
jct
2
290
WENDY [Excerpt]
tessaabrams
11
38k
The innovator’s Mindset - Leading Through an Era of Exponential Change - McGill University 2025
jdejongh
PRO
1
220
Site-Speed That Sticks
csswizardry
13
1.2k
Accessibility Awareness
sabderemane
1
150
Bridging the Design Gap: How Collaborative Modelling removes blockers to flow between stakeholders and teams @FastFlow conf
baasie
0
610
Ten Tips & Tricks for a 🌱 transition
stuffmc
0
150
Noah Learner - AI + Me: how we built a GSC Bulk Export data pipeline
techseoconnect
PRO
0
210
The Mindset for Success: Future Career Progression
greggifford
PRO
0
410
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!