Skip to content

added ci/cd test

added ci/cd test #1

Workflow file for this run

name: CI/CD Pipeline
on:
push:
branches:
- main
jobs:
docker-build-and-push:
runs-on: self-hosted
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Add SHORT_SHA to env
run: echo "SHORT_SHA=`echo ${GITHUB_SHA} | cut -c1-10`" >> $GITHUB_ENV
- name: Build Docker image
working-directory: .
env:
IMAGE_NAME: ${{ secrets.DOCKERHUB_USER }}/${{ vars.IMAGE_NAME }}:llama-cpp-${{ env.SHORT_SHA }}
run: |
docker build --network host -f docker\Dockerfile.llama-cpp -t "$IMAGE_NAME" .
- name: Tag Docker image as latest
env:
IMAGE_NAME: ${{ secrets.DOCKERHUB_USER }}/${{ vars.IMAGE_NAME }}:llama-cpp-${{ env.SHORT_SHA }}
IMAGE_LATEST: ${{ secrets.DOCKERHUB_USER }}/${{ vars.IMAGE_NAME }}:llama-cpp
run: |
docker tag "$IMAGE_NAME" "$IMAGE_LATEST"
- name: Log in to Docker Hub
run: echo ${{ secrets.DOCKERHUB_TOKEN }} | docker login -u ${{ secrets.DOCKERHUB_USER }} --password-stdin
- name: Push Docker image to Docker Hub
working-directory: .
env:
IMAGE_NAME: ${{ secrets.DOCKERHUB_USER }}/${{ vars.IMAGE_NAME }}
run: |
docker push --all-tags "$IMAGE_NAME"