Skip to content

Commit

Permalink
chore: #491 support arm64 (Apple Silicon) (#659)
Browse files Browse the repository at this point in the history
* Refactor the build to build everything in docker containers so it can be platform agnostic
* Refactor Makefile to abstract the docker build from the zarf package to simplify the ci build without a divergent pattern, as well as allow quicker dev iteration on docker builds
* refactor vllm Dockerfile to be multistage and use a smaller base image
* Remove unnecessary apt installs in final vllm docker image
* migrate macos instructions to uds dev README.md
* chore: update release workflow to set ARCH and LOCAL_VERSION docker build arguments

---------

Co-authored-by: Gavin Scallon <[email protected]>
Co-authored-by: Jon Perry <[email protected]>
  • Loading branch information
3 people authored Jul 12, 2024
1 parent cc3af1f commit adf3334
Show file tree
Hide file tree
Showing 19 changed files with 339 additions and 206 deletions.
4 changes: 4 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
**/*.tar.zst
**/Dockerfile*
**/.gitignore
**/Makefile
8 changes: 3 additions & 5 deletions .github/workflows/pytest.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -48,12 +48,10 @@ jobs:
python-version-file: 'pyproject.toml'

- name: Build Repeater
env:
LOCAL_VERSION: dev
run: |
make local-registry
make setup-repeater-deps
docker build -t ghcr.io/defenseunicorns/leapfrogai/repeater:dev packages/repeater
docker tag ghcr.io/defenseunicorns/leapfrogai/repeater:dev localhost:5000/defenseunicorns/leapfrogai/repeater:dev
make docker-repeater
- name: Run Repeater
run: docker run -p 50051:50051 -d --name=repeater ghcr.io/defenseunicorns/leapfrogai/repeater:dev

Expand Down
25 changes: 16 additions & 9 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -40,15 +40,18 @@ jobs:
with:
python-version-file: 'pyproject.toml'

- name: Download Python Wheels
run: make setup-api-deps setup-repeater-deps setup-llama-cpp-python-deps setup-vllm-deps setup-text-embeddings-deps setup-whisper-deps
- name: Download Python Wheels and Publish Builder Image
run: |
docker buildx build --platform amd64 --build-arg ARCH=amd64 -t ghcr.io/defenseunicorns/leapfrogai/leapfrogai-sdk:${{ steps.get_version.outputs.version-without-v }} --push -f src/leapfrogai_sdk/Dockerfile .
docker buildx build --platform arm64 --build-arg ARCH=arm64 -t ghcr.io/defenseunicorns/leapfrogai/leapfrogai-sdk:${{ steps.get_version.outputs.version-without-v }} --push -f src/leapfrogai_sdk/Dockerfile .
- name: Install Zarf
uses: defenseunicorns/setup-zarf@f95763914e20e493bb5d45d63e30e17138f981d6 # v1.0.0

- name: Build and Publish API
run: |
docker buildx build --platform amd64,arm64 -t ghcr.io/defenseunicorns/leapfrogai/leapfrogai-api:${{ steps.get_version.outputs.version-without-v }} --push packages/api
docker buildx build --platform amd64 --build-arg ARCH=amd64 --build-arg LOCAL_VERSION=${{ steps.get_version.outputs.version-without-v }} -t ghcr.io/defenseunicorns/leapfrogai/leapfrogai-api:${{ steps.get_version.outputs.version-without-v }} --push -f packages/api/Dockerfile .
docker buildx build --platform arm64 --build-arg ARCH=arm64 --build-arg LOCAL_VERSION=${{ steps.get_version.outputs.version-without-v }} -t ghcr.io/defenseunicorns/leapfrogai/leapfrogai-api:${{ steps.get_version.outputs.version-without-v }} --push -f packages/api/Dockerfile .
docker buildx build --platform amd64,arm64 -t ghcr.io/defenseunicorns/leapfrogai/api-migrations:${{ steps.get_version.outputs.version-without-v }} --push -f Dockerfile.migrations --build-arg="MIGRATIONS_DIR=packages/api/supabase/migrations" .
zarf package create packages/api --set=LEAPFROGAI_IMAGE_VERSION=${{ steps.get_version.outputs.version-without-v }} --architecture amd64 --confirm
Expand All @@ -62,7 +65,7 @@ jobs:
- name: Build and Publish UI
run: |
docker buildx build --platform amd64,arm64 -t ghcr.io/defenseunicorns/leapfrogai/leapfrogai-ui:${{ steps.get_version.outputs.version-without-v }} --push src/leapfrogai_ui
docker buildx build --platform amd64,arm64 -t ghcr.io/defenseunicorns/leapfrogai/leapfrogai-ui:${{ steps.get_version.outputs.version-without-v }} --push -f src/leapfrogai_ui/Dockerfile .
docker buildx build --platform amd64,arm64 -t ghcr.io/defenseunicorns/leapfrogai/ui-migrations:${{ steps.get_version.outputs.version-without-v }} --push -f Dockerfile.migrations --build-arg="MIGRATIONS_DIR=src/leapfrogai_ui/supabase/migrations" .
zarf package create packages/ui --set=IMAGE_VERSION=${{ steps.get_version.outputs.version-without-v }} --architecture amd64 --confirm
Expand All @@ -86,7 +89,8 @@ jobs:
- name: Build and Publish repeater
run: |
docker buildx build --platform amd64,arm64 -t ghcr.io/defenseunicorns/leapfrogai/repeater:${{ steps.get_version.outputs.version-without-v }} --push packages/repeater
docker buildx build --platform amd64 --build-arg ARCH=amd64 --build-arg LOCAL_VERSION=${{ steps.get_version.outputs.version-without-v }} -t ghcr.io/defenseunicorns/leapfrogai/repeater:${{ steps.get_version.outputs.version-without-v }} --push -f packages/repeater/Dockerfile .
docker buildx build --platform arm64 --build-arg ARCH=arm64 --build-arg LOCAL_VERSION=${{ steps.get_version.outputs.version-without-v }} -t ghcr.io/defenseunicorns/leapfrogai/repeater:${{ steps.get_version.outputs.version-without-v }} --push -f packages/repeater/Dockerfile .
zarf package create packages/repeater --set=IMAGE_VERSION=${{ steps.get_version.outputs.version-without-v }} --architecture amd64 --confirm
zarf package create packages/repeater --set=IMAGE_VERSION=${{ steps.get_version.outputs.version-without-v }} --architecture arm64 --confirm
Expand All @@ -99,7 +103,8 @@ jobs:
- name: Build and Publish llama
run: |
docker buildx build --platform amd64,arm64 -t ghcr.io/defenseunicorns/leapfrogai/llama-cpp-python:${{ steps.get_version.outputs.version-without-v }} --push packages/llama-cpp-python
docker buildx build --platform amd64 --build-arg ARCH=amd64 --build-arg LOCAL_VERSION=${{ steps.get_version.outputs.version-without-v }} -t ghcr.io/defenseunicorns/leapfrogai/llama-cpp-python:${{ steps.get_version.outputs.version-without-v }} --push -f packages/llama-cpp-python/Dockerfile .
docker buildx build --platform arm64 --build-arg ARCH=arm64 --build-arg LOCAL_VERSION=${{ steps.get_version.outputs.version-without-v }} -t ghcr.io/defenseunicorns/leapfrogai/llama-cpp-python:${{ steps.get_version.outputs.version-without-v }} --push -f packages/llama-cpp-python/Dockerfile .
zarf package create packages/llama-cpp-python --set=IMAGE_VERSION=${{ steps.get_version.outputs.version-without-v }} --architecture amd64 --confirm
zarf package create packages/llama-cpp-python --set=IMAGE_VERSION=${{ steps.get_version.outputs.version-without-v }} --architecture arm64 --confirm
Expand All @@ -112,7 +117,7 @@ jobs:
- name: Build and Publish vLLM
run: |
docker buildx build -t ghcr.io/defenseunicorns/leapfrogai/vllm:${{ steps.get_version.outputs.version-without-v }} --push packages/vllm
docker buildx build --build-arg LOCAL_VERSION=${{ steps.get_version.outputs.version-without-v }} -t ghcr.io/defenseunicorns/leapfrogai/vllm:${{ steps.get_version.outputs.version-without-v }} --push -f packages/vllm/Dockerfile .
zarf package create packages/vllm --set=IMAGE_VERSION=${{ steps.get_version.outputs.version-without-v }} --confirm
Expand All @@ -123,7 +128,8 @@ jobs:
- name: Build and Publish Text-Embeddings
run: |
docker buildx build --platform amd64,arm64 -t ghcr.io/defenseunicorns/leapfrogai/text-embeddings:${{ steps.get_version.outputs.version-without-v }} --push packages/text-embeddings
docker buildx build --platform amd64 --build-arg ARCH=amd64 --build-arg LOCAL_VERSION=${{ steps.get_version.outputs.version-without-v }} -t ghcr.io/defenseunicorns/leapfrogai/text-embeddings:${{ steps.get_version.outputs.version-without-v }} --push -f packages/text-embeddings/Dockerfile .
docker buildx build --platform arm64 --build-arg ARCH=arm64 --build-arg LOCAL_VERSION=${{ steps.get_version.outputs.version-without-v }} -t ghcr.io/defenseunicorns/leapfrogai/text-embeddings:${{ steps.get_version.outputs.version-without-v }} --push -f packages/text-embeddings/Dockerfile .
zarf package create packages/text-embeddings --set=IMAGE_VERSION=${{ steps.get_version.outputs.version-without-v }} --architecture amd64 --confirm
zarf package create packages/text-embeddings --set=IMAGE_VERSION=${{ steps.get_version.outputs.version-without-v }} --architecture arm64 --confirm
Expand All @@ -136,7 +142,8 @@ jobs:
- name: Build and Publish whisper
run: |
docker buildx build --platform amd64,arm64 -t ghcr.io/defenseunicorns/leapfrogai/whisper:${{ steps.get_version.outputs.version-without-v }} --push packages/whisper
docker buildx build --platform amd64 --build-arg ARCH=amd64 --build-arg LOCAL_VERSION=${{ steps.get_version.outputs.version-without-v }} -t ghcr.io/defenseunicorns/leapfrogai/whisper:${{ steps.get_version.outputs.version-without-v }} --push -f packages/whisper/Dockerfile .
docker buildx build --platform arm64 --build-arg ARCH=arm64 --build-arg LOCAL_VERSION=${{ steps.get_version.outputs.version-without-v }} -t ghcr.io/defenseunicorns/leapfrogai/whisper:${{ steps.get_version.outputs.version-without-v }} --push -f packages/whisper/Dockerfile .
zarf package create packages/whisper --set=IMAGE_VERSION=${{ steps.get_version.outputs.version-without-v }} --architecture amd64 --confirm
zarf package create packages/whisper --set=IMAGE_VERSION=${{ steps.get_version.outputs.version-without-v }} --architecture arm64 --confirm
Expand Down
6 changes: 4 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# temporary deployment and development artifacts
data/*
*.tar.zst
**/*.tar.zst
__pycache__
.venv
.ipynb_checkpoints
Expand All @@ -16,14 +16,16 @@ zarf-sbom/
*egg-info
egg-info/
build/
*.whl
**/*.whl
.model/
*.gguf
.env
.ruff_cache
.branches
.temp
src/leapfrogai_api/config.yaml
.idea/
/.python-version

# local model and tokenizer files
*.bin
Expand Down
Loading

0 comments on commit adf3334

Please sign in to comment.