From bcb874fdb01020ab0c4363bdebb958a101e04d5d Mon Sep 17 00:00:00 2001 From: Phil Szalay Date: Mon, 24 Feb 2025 10:24:08 +0100 Subject: [PATCH] Add github actions script --- .github/workflows/docker-build-push.yml | 49 +++++++++++++++++++++++++ docker-compose.yaml | 7 +--- 2 files changed, 50 insertions(+), 6 deletions(-) create mode 100644 .github/workflows/docker-build-push.yml diff --git a/.github/workflows/docker-build-push.yml b/.github/workflows/docker-build-push.yml new file mode 100644 index 000000000..e8a1969fc --- /dev/null +++ b/.github/workflows/docker-build-push.yml @@ -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 diff --git a/docker-compose.yaml b/docker-compose.yaml index 03993a773..56d4a7c67 100644 --- a/docker-compose.yaml +++ b/docker-compose.yaml @@ -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