Skip to content

Commit 42b0c0a

Browse files
authored
feat(docker): build docker for dgx spark (#244)
1 parent 489d922 commit 42b0c0a

File tree

2 files changed

+92
-0
lines changed

2 files changed

+92
-0
lines changed
Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
name: Build Spark Image
2+
3+
on:
4+
workflow_dispatch:
5+
push:
6+
branches:
7+
- main
8+
paths:
9+
- 'docker/**'
10+
- 'src/**'
11+
- 'pyproject.toml'
12+
- 'README.md'
13+
14+
15+
env:
16+
IMAGE_NAME: parallax
17+
NAMESPACE: gradientservice
18+
19+
jobs:
20+
build:
21+
runs-on: arc-public-parallax
22+
permissions:
23+
contents: read
24+
packages: write
25+
id-token: write
26+
attestations: write
27+
strategy:
28+
matrix:
29+
variant: [spark]
30+
31+
steps:
32+
- name: Checkout code
33+
uses: actions/checkout@v4
34+
35+
- name: Set up Docker Buildx
36+
uses: docker/setup-buildx-action@v3
37+
with:
38+
driver: remote
39+
endpoint: tcp://buildkit-buildkit-service.arc-systems:1234
40+
41+
42+
- name: Log in to Docker Hub
43+
uses: docker/login-action@v3
44+
with:
45+
username: ${{ secrets.DOCKERHUB_USERNAME }}
46+
password: ${{ secrets.DOCKERHUB_TOKEN }}
47+
48+
- name: Extract metadata
49+
id: meta
50+
uses: docker/metadata-action@v5
51+
with:
52+
images: ${{ env.NAMESPACE }}/${{ env.IMAGE_NAME }}
53+
tags: |
54+
type=ref,event=branch,suffix=-${{ matrix.variant }}
55+
type=ref,event=pr,suffix=-${{ matrix.variant }}
56+
type=raw,value=latest-${{ matrix.variant }},enable={{is_default_branch}}
57+
58+
- name: Build and push Docker image
59+
id: build
60+
uses: docker/build-push-action@v5
61+
with:
62+
context: .
63+
file: ./docker/Dockerfile.${{ matrix.variant }}
64+
push: true
65+
tags: ${{ steps.meta.outputs.tags }}
66+
labels: ${{ steps.meta.outputs.labels }}
67+
cache-from: type=gha
68+
cache-to: type=gha,mode=max
69+
platforms: linux/arm64

docker/Dockerfile.spark

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
FROM lmsysorg/sglang:spark
2+
3+
ENV SGLANG_ENABLE_JIT_DEEPGEMM=0
4+
5+
WORKDIR /parallax
6+
7+
COPY README.md ./README.md
8+
COPY src ./src
9+
COPY pyproject.toml ./pyproject.toml
10+
11+
RUN apt-get update
12+
13+
RUN git clone --branch v0.29.1 https://github.com/ml-explore/mlx.git && \
14+
apt-get install libblas-dev liblapack-dev liblapacke-dev -y && \
15+
cd mlx && \
16+
PYPI_RELEASE=1 pip install . --break-system-packages && \
17+
cd ..
18+
19+
# patch sglang version and model_parallel.py for current sglang spark docker
20+
RUN sed -i 's/sglang\[all\]==0.5.4.post1/sglang\[all\]==0.5.4.post2/g' pyproject.toml
21+
RUN sed -i 's/use_torch_symm_mem=use_torch_symm_mem/use_torch_symm_mem_all_reduce=use_torch_symm_mem/g' src/parallax/sglang/monkey_patch_utils/model_parallel.py
22+
23+
RUN pip install -e '.[gpu]' --break-system-packages

0 commit comments

Comments
 (0)