Add github actions script

This commit is contained in:
Phil Szalay 2025-02-24 10:24:08 +01:00
parent 7678489c08
commit bcb874fdb0
2 changed files with 50 additions and 6 deletions

49
.github/workflows/docker-build-push.yml vendored Normal file
View File

@ -0,0 +1,49 @@
name: Build and Push Docker Image
on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]
env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}
jobs:
build-and-push:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Log in to the Container registry
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@v5
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
tags: |
type=sha,format=long
type=ref,event=branch
type=ref,event=tag
- name: Build and push Docker image
uses: docker/build-push-action@v5
with:
context: .
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
build-args: |
LITELLM_BASE_URL=/litellm

View File

@ -17,12 +17,7 @@ services:
- host.docker.internal:host-gateway
open-webui:
build:
context: .
args:
LITELLM_BASE_URL: '/litellm'
dockerfile: Dockerfile
image: ghcr.io/open-webui/open-webui:${WEBUI_DOCKER_TAG-main}
image: ghcr.io/${GITHUB_REPOSITORY}:main
container_name: open-webui
volumes:
- ./backend/data:/app/backend/data