build privategpt #130
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: build privategpt | |
on: | |
push: | |
branches: | |
- 'main' | |
paths: | |
- 'privategpt/**' | |
- '!privategpt/README.md' | |
schedule: | |
# cron: 'min hour day month weekday' | |
- cron: '0 4 * * 3' # every wednesday on 04:00 | |
workflow_dispatch: | |
inputs: | |
logLevel: | |
description: 'Log level' | |
required: true | |
default: 'warning' | |
tags: | |
description: 'run action manually' | |
jobs: | |
multi: | |
runs-on: self-hosted | |
steps: | |
# https://github.com/actions/checkout | |
- name: Checkout | |
uses: actions/checkout@v4 | |
# https://github.com/docker/setup-qemu-action | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v3 | |
# https://github.com/docker/setup-buildx-action | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
# https://github.com/docker/login-action | |
- name: Login to DockerHub | |
uses: docker/login-action@v3 | |
with: | |
username: ${{ secrets.DOCKERHUB_USERNAME }} | |
password: ${{ secrets.DOCKERHUB_TOKEN }} | |
# https://github.com/marketplace/actions/free-disk-space-ubuntu | |
- name: Free Disk Space (Ubuntu) | |
uses: jlumbroso/free-disk-space@main | |
with: | |
# this might remove tools that are actually needed, | |
# if set to "true" but frees about 6 GB | |
tool-cache: true | |
# all of these default to true, but feel free to set to | |
# "false" if necessary for your workflow | |
android: true | |
dotnet: true | |
haskell: true | |
large-packages: true | |
docker-images: false | |
swap-storage: true | |
- name: Build and Tag | |
id: tag | |
run: | | |
docker build -t 3x3cut0r/privategpt:latest --build-arg HUGGINGFACE_ACCESS_TOKEN=${{ secrets.HUGGINGFACE_ACCESS_TOKEN }} ./privategpt | |
CONTAINER_ID=$(docker create 3x3cut0r/privategpt:latest) | |
docker cp "${CONTAINER_ID}:/VERSION" VERSION | |
VERSION=$(cat VERSION | grep privategpt | cut -d= -f2 | head -n 1) | |
echo "VERSION=$VERSION" >> $GITHUB_OUTPUT | |
# https://github.com/marketplace/actions/free-disk-space-ubuntu | |
- name: Free Disk Space (Docker) | |
uses: jlumbroso/free-disk-space@main | |
with: | |
# this might remove tools that are actually needed, | |
# if set to "true" but frees about 6 GB | |
tool-cache: true | |
# all of these default to true, but feel free to set to | |
# "false" if necessary for your workflow | |
android: true | |
dotnet: true | |
haskell: true | |
large-packages: true | |
docker-images: true | |
swap-storage: true | |
# https://github.com/docker/build-push-action | |
- name: Build and push | |
uses: docker/build-push-action@v5 | |
with: | |
context: ./privategpt | |
file: ./privategpt/Dockerfile | |
platforms: linux/amd64,linux/arm64 | |
push: true | |
build-args: | | |
HUGGINGFACE_ACCESS_TOKEN=${{ secrets.HUGGINGFACE_ACCESS_TOKEN }} | |
tags: | | |
3x3cut0r/privategpt:latest | |
3x3cut0r/privategpt:${{ steps.tag.outputs.VERSION }} |