Skip to content

Commit

Permalink
add cicl cache
Browse files Browse the repository at this point in the history
  • Loading branch information
reymondzzzz committed Jan 9, 2024
1 parent 4bff4d2 commit 1a0c426
Show file tree
Hide file tree
Showing 4 changed files with 51 additions and 33 deletions.
31 changes: 31 additions & 0 deletions .github/scripts/build_base_docker.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
#!/bin/bash

SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
REPO_DIR=$(realpath $SCRIPT_DIR/../..)

ORIGIN_DOCKERFILE=${REPO_DIR}/Dockerfile
BASE_DOCKERFILE=${SCRIPT_DIR}/Dockerfile

BASE_IMAGE=$(cat $ORIGIN_DOCKERFILE | grep FROM | head -1 | awk '{print $2}')
echo FROM $BASE_IMAGE > $BASE_DOCKERFILE

echo ENV INSTALL_OPTIONAL=TRUE >> $BASE_DOCKERFILE
echo ENV FLASH_ATTENTION_FORCE_BUILD=TRUE >> $BASE_DOCKERFILE

echo RUN apt-get update >> $BASE_DOCKERFILE
echo 'RUN DEBIAN_FRONTEND="noninteractive" TZ=Etc/UTC apt-get install -y git python3 python3-pip python3-packaging && rm -rf /var/lib/{apt,dpkg,cache,log}' >> $BASE_DOCKERFILE

TORCH_STR=$(cat $ORIGIN_DOCKERFILE | grep torch==)

echo ${TORCH_STR} >> $BASE_DOCKERFILE
echo RUN pip install ninja >> $BASE_DOCKERFILE

REQUIREMENTS=$(cat $SCRIPT_DIR/requirements.txt)
IFS=$'\n' read -rd '' -a REQUIREMENTS <<<"$REQUIREMENTS"

for requirement in "${REQUIREMENTS[@]}"
do
echo "RUN MAX_JOBS=8 pip install -v $requirement" >> $BASE_DOCKERFILE
done

docker buildx build --platform linux/amd64 -t ghcr.io/smallcloud/refact_base_image:latest --push -f $BASE_DOCKERFILE $REPO_DIR
12 changes: 12 additions & 0 deletions .github/scripts/cicl_docker_injection.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#/bin/bash

SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
REPO_DIR=$(realpath $SCRIPT_DIR/../..)

ORIGIN_DOCKERFILE=${REPO_DIR}/Dockerfile
BASE_IMAGE=$(cat $ORIGIN_DOCKERFILE | grep FROM | head -1 | awk '{print $2}')

CACHE_IMAGE="ghcr.io/smallcloud/refact_base_image:latest"

sed -i "s!${BASE_IMAGE}!${CACHE_IMAGE}!" ${ORIGIN_DOCKERFILE}

2 changes: 2 additions & 0 deletions .github/scripts/requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
git+https://github.com/smallcloudai/flash-attention@feat/alibi
git+https://github.com/smallcloudai/vllm@refact_model_deps
39 changes: 6 additions & 33 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ jobs:
run: |
echo "now_tag=RELEASE.$(TZ=UTC date +'%Y-%m-%dT%H-%M-%SZ')" >> "$GITHUB_OUTPUT"
amd64:
name: Build amd64
cicl:
name: Cicl
runs-on: ubuntu-latest
needs: [setup-vars]
outputs:
Expand All @@ -33,6 +33,10 @@ jobs:
sudo rm -rf /usr/local/lib/android
sudo rm -rf /opt/ghc
- name: Inject cache docker image
run: |
./.github/scripts/cicl_docker_injection.sh
- name: Set up QEMU
uses: docker/setup-qemu-action@v2

Expand All @@ -48,34 +52,3 @@ jobs:
smallcloud/refact_self_hosting:RELEASE.${{ needs.setup-vars.outputs.now_tag }}
platforms: |
linux/amd64
# commented temporary until cpu is not supported
# arm64:
# name: Build arm64
# runs-on: ubuntu-latest
# needs: [setup-vars]
# outputs:
# version: ${{ steps.properties.outputs.version }}
# changelog: ${{ steps.properties.outputs.changelog }}
# steps:
# # Free GitHub Actions Environment Disk Space
# - name: Maximize Build Space
# run: |
# sudo rm -rf /usr/share/dotnet
# sudo rm -rf /usr/local/lib/android
# sudo rm -rf /opt/ghc
#
# - name: Set up QEMU
# uses: docker/setup-qemu-action@v2
#
# - name: Set up Docker Buildx
# uses: docker/setup-buildx-action@v2
#
# - name: Build and push
# uses: docker/build-push-action@v4
# with:
# push: false
# tags: |
# smallcloud/refact_self_hosting:latest
# smallcloud/refact_self_hosting:RELEASE.${{ needs.setup-vars.outputs.now_tag }}
# platforms: |
# linux/arm64

0 comments on commit 1a0c426

Please sign in to comment.