Repository navigation
Expand file tree
/
Copy pathbuild_and_upload_docker.sh
More file actions
executable file
·54 lines (46 loc) · 2.01 KB
/
Copy pathbuild_and_upload_docker.sh
File metadata and controls
executable file
·54 lines (46 loc) · 2.01 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
#!/bin/bash
set -e
# NOTE(alpin): These are the default values for my own machine.
MAX_JOBS=64
NVCC_THREADS=64
CUDA_VERSION=13.0.0
PYTHON_VERSION=3.12
TORCH_CUDA_ARCH_LIST="7.0 7.5 8.0 8.9 9.0 10.0 11.0 12.0"
while [[ "$#" -gt 0 ]]; do
case $1 in
--max_jobs) MAX_JOBS="$2"; shift ;;
--nvcc_threads) NVCC_THREADS="$2"; shift ;;
--cuda_version) CUDA_VERSION="$2"; shift ;;
--python_version) PYTHON_VERSION="$2"; shift ;;
*) echo "Unknown parameter passed: $1"; exit 1 ;;
esac
shift
done
# Step 1: Build the wheel
DOCKER_BUILDKIT=1 docker build . -f docker/Dockerfile --target build --tag alpindale/aphrodite-build \
--build-arg CUDA_VERSION="$CUDA_VERSION" \
--build-arg PYTHON_VERSION="$PYTHON_VERSION" \
--build-arg torch_cuda_arch_list="$TORCH_CUDA_ARCH_LIST" \
--build-arg max_jobs="$MAX_JOBS" \
--build-arg nvcc_threads="$NVCC_THREADS"
# Create a temporary container to extract the wheel
docker run -d --name sonar-build-container alpindale/aphrodite-build tail -f /dev/null
# Create dist directory if it doesn't exist
mkdir -p dist
# Copy the wheel to the dist directory
docker cp sonar-build-container:/workspace/dist .
docker stop sonar-build-container && docker rm sonar-build-container
# Step 2: Build the final Docker image using the wheel
DOCKER_BUILDKIT=1 docker build -f docker/Dockerfile . --target sonar-openai --tag alpindale/aphrodite-openai \
--build-arg CUDA_VERSION="$CUDA_VERSION" \
--build-arg PYTHON_VERSION="$PYTHON_VERSION" \
--build-arg torch_cuda_arch_list="$TORCH_CUDA_ARCH_LIST" \
--build-arg max_jobs="$MAX_JOBS" \
--build-arg nvcc_threads="$NVCC_THREADS"
# Step 3: Tag and push the Docker image
commit=$(git rev-parse --short HEAD)
docker tag alpindale/aphrodite-openai alpindale/aphrodite-openai:"${commit}"
docker push alpindale/aphrodite-openai:"${commit}"
docker tag alpindale/aphrodite-openai alpindale/aphrodite-openai:latest
docker push alpindale/aphrodite-openai:latest
echo "Build and upload completed successfully!"