Skip to content

Commit

Permalink
added ci/cd test
Browse files Browse the repository at this point in the history
  • Loading branch information
NiftyliuS committed Feb 3, 2024
1 parent bca0d37 commit 045065c
Showing 1 changed file with 43 additions and 0 deletions.
43 changes: 43 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
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"

0 comments on commit 045065c

Please sign in to comment.