This commit is contained in:
Xi Yan 2025-01-14 14:39:37 -08:00
parent 4747c844a2
commit d97bcaf625
3 changed files with 41 additions and 5 deletions

30
.github/workflows/publish-to-docker.yml vendored Normal file
View file

@ -0,0 +1,30 @@
name: Docker Build and Publish
on:
push
jobs:
build-and-push:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Log in to the Container registry
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Custom build docker image
run: |
pip install --no-cache --index-url https://pypi.org/simple/ --extra-index-url https://test.pypi.org/simple/ llama-stack==0.0.63.dev20250114
TESTPYPI_VERSION=0.0.63.dev20250114 llama stack build --template ollama --image-type docker
docker images

View file

@ -123,7 +123,7 @@ def build_image(
str(build_file_path),
str(BUILDS_BASE_DIR / ImageType.docker.value),
" ".join(normal_deps),
dockerfile_only,
str(dockerfile_only),
]
elif build_config.image_type == ImageType.conda.value:
script = (

View file

@ -18,7 +18,7 @@ if [ "$#" -lt 4 ]; then
exit 1
fi
special_pip_deps="$6"
special_pip_deps="$7"
set -euo pipefail
@ -28,7 +28,7 @@ docker_base=$2
build_file_path=$3
host_build_dir=$4
pip_dependencies=$5
dockerfile_only=$7
dockerfile_only=$6
# Define color codes
RED='\033[0;31m'
@ -147,8 +147,6 @@ ENTRYPOINT ["python", "-m", "llama_stack.distribution.server.server", "--templat
EOF
printf "Dockerfile created successfully in $TEMP_DIR/Dockerfile\n\n"
cp "$TEMP_DIR/Dockerfile" "./Dockerfile"
printf "Dockerfile saved to ./Dockerfile\n\n"
cat $TEMP_DIR/Dockerfile
printf "\n"
@ -178,6 +176,14 @@ fi
# Add version tag to image name
image_tag="$image_name:$version_tag"
if [ "$dockerfile_only" = "True" ]; then
echo "Skipping docker build as dockerfile_only=True"
dockerfile_name="Dockerfile.${image_tag}"
cp "$TEMP_DIR/Dockerfile" "./${dockerfile_name}"
printf "Dockerfile saved to ./${dockerfile_name}\n\n"
exit 0
fi
# Detect platform architecture
ARCH=$(uname -m)
if [ -n "$BUILD_PLATFORM" ]; then