mirror of
https://github.com/khoaliber/khoj.git
synced 2026-03-02 21:19:12 +00:00
Build for arm64 on arm64 runner. Parallelize arm64, x64 docker builds
- Building arm64 image on an ubuntu arm64 runner reduces `yarn build'
step time by 75% from 12mins to 3mins.
- This is because no QEMU emulation for arm64 on x86 is required now
- Parallelizing x64 and arm64 platform builds halves build time on top
- Revert to use standard ubuntu-latest runner as large x64 runner
doesn't give much more speed improvements
This results an effective additional 50%-66% reduction in build time
on top of #987.
So a full dockerize workflow run now takes *10 mins* vs previous 35+mins.
This is a total of *72% improvement* in max dockerize run time.
Get additional speed improvements when docker layer cache hit.
This commit is contained in:
17
.github/workflows/dockerize.yml
vendored
17
.github/workflows/dockerize.yml
vendored
@@ -38,13 +38,16 @@ env:
|
|||||||
jobs:
|
jobs:
|
||||||
build:
|
build:
|
||||||
name: Publish Khoj Docker Images
|
name: Publish Khoj Docker Images
|
||||||
runs-on: ubuntu-linux-x64-high
|
|
||||||
strategy:
|
strategy:
|
||||||
fail-fast: false
|
fail-fast: false
|
||||||
matrix:
|
matrix:
|
||||||
image:
|
image:
|
||||||
- 'local'
|
- 'local'
|
||||||
- 'cloud'
|
- 'cloud'
|
||||||
|
platform:
|
||||||
|
- linux/amd64
|
||||||
|
- linux/arm64
|
||||||
|
runs-on: ${{ matrix.platform == 'linux/arm64' && 'ubuntu-linux-arm64' || 'ubuntu-latest' }}
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout Code
|
- name: Checkout Code
|
||||||
uses: actions/checkout@v3
|
uses: actions/checkout@v3
|
||||||
@@ -78,7 +81,7 @@ jobs:
|
|||||||
with:
|
with:
|
||||||
context: .
|
context: .
|
||||||
file: Dockerfile
|
file: Dockerfile
|
||||||
platforms: linux/amd64, linux/arm64
|
platforms: ${{ matrix.platform }}
|
||||||
push: true
|
push: true
|
||||||
tags: |
|
tags: |
|
||||||
ghcr.io/${{ github.repository }}:${{ env.DOCKER_IMAGE_TAG }}
|
ghcr.io/${{ github.repository }}:${{ env.DOCKER_IMAGE_TAG }}
|
||||||
@@ -86,8 +89,8 @@ jobs:
|
|||||||
build-args: |
|
build-args: |
|
||||||
VERSION=${{ steps.hatch.outputs.version }}
|
VERSION=${{ steps.hatch.outputs.version }}
|
||||||
PORT=42110
|
PORT=42110
|
||||||
cache-from: type=gha,scope=${{ matrix.image }}
|
cache-from: type=gha,scope=${{ matrix.image }}-${{ matrix.platform }}
|
||||||
cache-to: type=gha,mode=max,scope=${{ matrix.image }}
|
cache-to: type=gha,mode=max,scope=${{ matrix.image }}-${{ matrix.platform}}
|
||||||
|
|
||||||
- name: 📦️⛅️ Build and Push Cloud Docker Image
|
- name: 📦️⛅️ Build and Push Cloud Docker Image
|
||||||
uses: docker/build-push-action@v4
|
uses: docker/build-push-action@v4
|
||||||
@@ -95,7 +98,7 @@ jobs:
|
|||||||
with:
|
with:
|
||||||
context: .
|
context: .
|
||||||
file: prod.Dockerfile
|
file: prod.Dockerfile
|
||||||
platforms: linux/amd64, linux/arm64
|
platforms: ${{ matrix.platform }}
|
||||||
push: true
|
push: true
|
||||||
tags: |
|
tags: |
|
||||||
ghcr.io/${{ github.repository }}-cloud:${{ env.DOCKER_IMAGE_TAG }}
|
ghcr.io/${{ github.repository }}-cloud:${{ env.DOCKER_IMAGE_TAG }}
|
||||||
@@ -103,5 +106,5 @@ jobs:
|
|||||||
build-args: |
|
build-args: |
|
||||||
VERSION=${{ steps.hatch.outputs.version }}
|
VERSION=${{ steps.hatch.outputs.version }}
|
||||||
PORT=42110
|
PORT=42110
|
||||||
cache-from: type=gha,scope=${{ matrix.image }}
|
cache-from: type=gha,scope=${{ matrix.image }}-${{ matrix.platform }}
|
||||||
cache-to: type=gha,mode=max,scope=${{ matrix.image }}
|
cache-to: type=gha,mode=max,scope=${{ matrix.image }}-${{ matrix.platform}}
|
||||||
|
|||||||
Reference in New Issue
Block a user