Skip to content

Commit

Permalink
add nightly and release workflows
Browse files Browse the repository at this point in the history
fix workflows
  • Loading branch information
reymondzzzz committed Jan 11, 2024
1 parent 8786dae commit cf70f8c
Show file tree
Hide file tree
Showing 8 changed files with 140 additions and 60 deletions.
31 changes: 0 additions & 31 deletions .github/scripts/build_base_docker.sh

This file was deleted.

5 changes: 2 additions & 3 deletions .github/scripts/cicl_docker_injection.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,8 @@ 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"
CACHE_IMAGE="FROM ghcr.io/smallcloudai/refact_base_image:latest"

sed -i "s!${BASE_IMAGE}!${CACHE_IMAGE}!" ${ORIGIN_DOCKERFILE}
sed -i "s!INCLUDE Dockerfile.base!${CACHE_IMAGE}!" ${ORIGIN_DOCKERFILE}

2 changes: 0 additions & 2 deletions .github/scripts/requirements.txt

This file was deleted.

10 changes: 8 additions & 2 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,13 +44,19 @@ jobs:
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2

- name: Login to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ secrets.GH_USER }}
password: ${{ secrets.GH_TOKEN }}

- name: Build
uses: docker/build-push-action@v4
with:
push: false
context: .
tags: |
smallcloud/refact_self_hosting:latest
smallcloud/refact_self_hosting:RELEASE.${{ needs.setup-vars.outputs.now_tag }}
smallcloud/refact_self_hosting:${{ needs.setup-vars.outputs.now_tag }}
platforms: |
linux/amd64
56 changes: 56 additions & 0 deletions .github/workflows/nightly.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
name: Nightly
on:
push:
branches: [dev]
workflow_dispatch:

jobs:
build:
name: Build
runs-on: ubuntu-latest
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: Checkout
uses: actions/checkout@v4

- name: Inject cache docker image
run: |
./.github/scripts/cicl_docker_injection.sh
- name: Set up QEMU
uses: docker/setup-qemu-action@v2

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2

- name: Login to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ secrets.GH_USER }}
password: ${{ secrets.GH_TOKEN }}

- name: Login to DockerHub Container Registry
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USER }}
password: ${{ secrets.DOCKERHUB_TOKEN }}

- name: Build
uses: docker/build-push-action@v4
with:
push: true
context: .
tags: |
smallcloud/refact_self_hosting:nightly
platforms: |
linux/amd64
58 changes: 58 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
name: Release
on:
push:
tags:
- v*
workflow_dispatch:

jobs:
build:
name: Build
runs-on: ubuntu-latest
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: Checkout
uses: actions/checkout@v4

- name: Inject cache docker image
run: |
./.github/scripts/cicl_docker_injection.sh
- name: Set up QEMU
uses: docker/setup-qemu-action@v2

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2

- name: Login to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ secrets.GH_USER }}
password: ${{ secrets.GH_TOKEN }}

- name: Login to DockerHub Container Registry
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USER }}
password: ${{ secrets.DOCKERHUB_TOKEN }}

- name: Build
uses: docker/build-push-action@v4
with:
push: true
context: .
tags: |
smallcloud/refact_self_hosting:${{github.ref_name}}
smallcloud/refact_self_hosting:latest
platforms: |
linux/amd64
25 changes: 3 additions & 22 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
FROM nvidia/cuda:11.8.0-cudnn8-devel-ubuntu22.04
# syntax = devthefuture/dockerfile-x

INCLUDE Dockerfile.base

RUN apt-get update
RUN DEBIAN_FRONTEND="noninteractive" apt-get install -y \
Expand All @@ -17,30 +19,9 @@ RUN DEBIAN_FRONTEND="noninteractive" apt-get install -y \
RUN echo "export PATH=/usr/local/cuda/bin:\$PATH" > /etc/profile.d/50-smc.sh
RUN update-alternatives --install /usr/bin/python python /usr/bin/python3 1

# torch
RUN pip install --no-cache-dir torch==2.1.2 --index-url https://download.pytorch.org/whl/cu118
# auto-gptq
RUN pip install auto-gptq==0.6.0 --extra-index-url https://huggingface.github.io/autogptq-index/whl/cu118/

# linguist requisites
RUN apt-get update
RUN DEBIAN_FRONTEND=noninteractive TZ=Etc/UTC apt-get install -y \
expect \
ruby-full \
ruby-bundler \
build-essential \
cmake \
pkg-config \
libicu-dev \
zlib1g-dev \
libcurl4-openssl-dev \
libssl-dev
RUN git clone https://github.com/smallcloudai/linguist.git /tmp/linguist \
&& cd /tmp/linguist \
&& bundle install \
&& rake build_gem
ENV PATH="${PATH}:/tmp/linguist/bin"

RUN DEBIAN_FRONTEND=noninteractive TZ=Etc/UTC apt-get install -y python3-packaging

# cassandra
Expand Down
13 changes: 13 additions & 0 deletions Dockerfile.base
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
FROM nvidia/cuda:11.8.0-cudnn8-devel-ubuntu22.04
ENV INSTALL_OPTIONAL=TRUE
ENV FLASH_ATTENTION_FORCE_BUILD=TRUE
RUN apt-get update
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} \

RUN pip install --no-cache-dir torch==2.1.2 --index-url https://download.pytorch.org/whl/cu118

RUN pip install ninja

RUN MAX_JOBS=8 pip install -v git+https://github.com/smallcloudai/flash-attention@feat/alibi
RUN MAX_JOBS=8 pip install -v git+https://github.com/smallcloudai/vllm@refact_model_deps

0 comments on commit cf70f8c

Please sign in to comment.