-
-
Notifications
You must be signed in to change notification settings - Fork 14
72 lines (63 loc) · 2.56 KB
/
publish-docker.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
name: Build and Test
on:
push:
branches: [main]
release:
types: [published]
workflow_dispatch:
jobs:
build-ezlocalai:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Extract GitHub info
run: |
echo "BRANCH_NAME=$(echo ${GITHUB_REF#refs/heads/} | sed 's/[^a-zA-Z0-9._-]/-/g')" >> $GITHUB_ENV
echo "ORG_NAME=$(echo ${{ github.repository }} | cut -d'/' -f 1 | tr '[:upper:]' '[:lower:]')" >> $GITHUB_ENV
echo "GITHUB_USER=$(echo ${{ github.actor }} | tr '[:upper:]' '[:lower:]')" >> $GITHUB_ENV
echo "REPO_NAME=$(echo ${{ github.repository }} | cut -d'/' -f 2 | tr '[:upper:]' '[:lower:]')" >> $GITHUB_ENV
id: extract_branch
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to DockerHub
uses: docker/login-action@v3
with:
username: ${{ vars.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Login to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ env.GITHUB_USER }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and push Docker image
uses: docker/build-push-action@v5
with:
context: .
file: ./Dockerfile
platforms: linux/amd64
push: true
cache-from: type=gha
cache-to: type=gha,mode=max
tags: |
${{ vars.DOCKERHUB_USERNAME }}/${{ env.REPO_NAME }}:latest
${{ vars.DOCKERHUB_USERNAME }}/${{ env.REPO_NAME }}:${{ env.BRANCH_NAME }}
${{ vars.DOCKERHUB_USERNAME }}/${{ env.REPO_NAME }}:${{ env.BRANCH_NAME }}-${{ github.sha }}
ghcr.io/${{ env.ORG_NAME }}/${{ env.REPO_NAME }}:latest
ghcr.io/${{ env.ORG_NAME }}/${{ env.REPO_NAME }}:${{ env.BRANCH_NAME }}
ghcr.io/${{ env.ORG_NAME }}/${{ env.REPO_NAME }}:${{ env.BRANCH_NAME }}-${{ github.sha }}
- name: Docker Hub Description
uses: peter-evans/dockerhub-description@v4
with:
username: ${{ vars.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
repository: ${{ vars.DOCKERHUB_USERNAME }}/ezlocalai
test-ezlocalai:
uses: josh-xt/AGiXT/.github/workflows/operation-test-with-jupyter.yml@main
with:
notebook: tests.ipynb
image: ghcr.io/devxt-llc/ezlocalai:main
port: "8091"
additional-python-dependencies: openai requests python-dotenv
needs: build-ezlocalai