Skip to content

Liner fixes

Liner fixes #65

name: "CD: build & push image"
on:
push:
branches:
- build-push-llama3-image
- build-push-phi3-image
- build-push-mock-image
workflow_dispatch:
env:
PYTHON_DEFAULT_VERSION: "3.12"
TAG_VERSION: "v0-latest"
DOCKER_REPO_NAME: "backenddevelopersltd/compute-horde-prompt-gen"
jobs:
deploy:
timeout-minutes: 30
runs-on:
group: bulkier
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Set up Python ${{ env.PYTHON_DEFAULT_VERSION }}
uses: actions/setup-python@v5
with:
python-version: ${{ env.PYTHON_DEFAULT_VERSION }}
- name: Login Dockerhub
run: echo "${{ secrets.DOCKERHUB_KEY }}" | docker login -u "${{ secrets.DOCKERHUB_USERNAME }}" --password-stdin
- name: Install dependencies
run: |
python -m pip install transformers torch
- name: Set environment variables based on branch
run: |
if [[ "${{ github.ref }}" == "refs/heads/build-push-llama3-image" ]]; then
echo "MODEL_NAME=llama3" >> $GITHUB_ENV
elif [[ "${{ github.ref }}" == "refs/heads/build-push-phi3-image" ]]; then
echo "MODEL_NAME=phi3" >> $GITHUB_ENV
elif [[ "${{ github.ref }}" == "refs/heads/build-push-mock-image" ]]; then
echo "MODEL_NAME=mock" >> $GITHUB_ENV
fi
- name: Docker build and push
run: |
IMAGE_NAME="${DOCKER_REPO_NAME}-${MODEL_NAME}:${TAG_VERSION}"
cd src/compute_horde_prompt_gen
python download_model.py --model_name ${MODEL_NAME} --huggingface_token "${{ secrets.HUGGINGFACE_API_KEY }}"
docker build -t $IMAGE_NAME .
docker push $IMAGE_NAME