Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
The diff you're trying to view is too large. We only load the first 3000 changed files.
47 changes: 6 additions & 41 deletions .github/workflows/deployment.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@


name: deployment

on:
Expand Down Expand Up @@ -27,52 +25,19 @@ jobs:
key: ${{ secrets.DEV_SSH_KEY }}
script: |
set -ex
source ~/.profile
export BRANCH="${{ github.event.inputs.branch }}"
export REPO_DIR="/home/ubuntu/cg_langbuilder/LangBuilder"
export OPENWEBUI_DIR="$REPO_DIR/openwebui"
export OPENWEBUI_BACKEND_DIR="$OPENWEBUI_DIR/backend"
export LANGBUILDER_DIR="$REPO_DIR/langbuilder"

cd "$REPO_DIR"
git stash
git fetch origin
git checkout "$BRANCH"
git reset --hard "origin/$BRANCH"

set +e
if [ -f /tmp/openwebui_backend.pid ]; then
kill $(cat /tmp/openwebui_backend.pid) || true
# rm /tmp/openwebui_backend.pid
fi

if [ -f /tmp/langbuilder.pid ]; then
kill $(cat /tmp/langbuilder.pid) || true
# rm /tmp/langbuilder.pid
fi
set -e


# Cargar nvm y usar Node >=20
export NVM_DIR="$HOME/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"
nvm use 22 || nvm install 22
node -v
npm -v

cd "$OPENWEBUI_DIR"
npm install --legacy-peer-deps
npm run build

cd "$OPENWEBUI_BACKEND_DIR"
source ~/miniconda3/etc/profile.d/conda.sh
conda activate open-webui
nohup bash dev.sh > /tmp/openwebui_backend.log 2>&1 &
conda deactivate

cd "$LANGBUILDER_DIR"
nohup make run_cli > /tmp/langbuilder.log 2>&1 &
cd deploy
docker network create langbuilder-network 2>/dev/null || true
docker compose pull
docker compose -f docker-compose.langbuilder.yml -f docker-compose.openwebui.yml --env-file .env up -d

echo "Deploy completo en branch $BRANCH"
tail -n 20 /tmp/openwebui_backend.log || true
tail -n 20 /tmp/langbuilder.log || true
echo "Deploy complete on branch $BRANCH"
docker compose -f docker-compose.langbuilder.yml -f docker-compose.openwebui.yml ps
194 changes: 194 additions & 0 deletions .github/workflows/docker-build-langbuilder.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,194 @@
name: Build and Push LangBuilder
run-name: Build LangBuilder Docker images by @${{ github.actor }}

on:
workflow_dispatch:
inputs:
tag:
description: "Image tag (e.g., latest, v1.0.0)"
required: false
type: string
default: "latest"
ref:
description: "Git ref to build from (branch, tag, SHA)"
required: false
type: string

push:
branches: [main]
paths:
- "langbuilder/src/**"
- "langbuilder/pyproject.toml"
- "langbuilder/uv.lock"
- "langbuilder/docker/**"
- "langbuilder/langbuilder_compat/**"
- ".github/workflows/docker-build-langbuilder.yml"

env:
REGISTRY: ghcr.io
IMAGE_PREFIX: ghcr.io/cloudgeometry

jobs:
build-main:
name: Build main image
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
outputs:
tag: ${{ steps.tag.outputs.tag }}
short_sha: ${{ steps.tag.outputs.short_sha }}
steps:
- name: Checkout
uses: actions/checkout@v4
with:
ref: ${{ inputs.ref || github.ref }}

- name: Determine image tag
id: tag
env:
TAG_INPUT: ${{ inputs.tag }}
EVENT_NAME: ${{ github.event_name }}
FULL_SHA: ${{ github.sha }}
run: |
if [[ "$EVENT_NAME" == "workflow_dispatch" && -n "$TAG_INPUT" ]]; then
TAG="$TAG_INPUT"
else
TAG="latest"
fi
SHORT_SHA="${FULL_SHA:0:7}"
echo "tag=$TAG" >> "$GITHUB_OUTPUT"
echo "short_sha=$SHORT_SHA" >> "$GITHUB_OUTPUT"

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
with:
version: latest
driver: docker-container
driver-opts: |
image=moby/buildkit:v0.22.0
network=host

- name: Login to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Build and push main image
uses: Wandalen/wretry.action@v3.8.0
with:
action: docker/build-push-action@v6
with: |
context: ./langbuilder
file: ./langbuilder/docker/build_and_push.Dockerfile
push: true
tags: ${{ env.IMAGE_PREFIX }}/langbuilder:${{ steps.tag.outputs.tag }},${{ env.IMAGE_PREFIX }}/langbuilder:${{ steps.tag.outputs.short_sha }}
platforms: linux/amd64
cache-from: type=gha,scope=langbuilder-main
cache-to: type=gha,mode=max,scope=langbuilder-main
provenance: false

build-backend:
name: Build backend image
runs-on: ubuntu-latest
needs: build-main
permissions:
contents: read
packages: write
steps:
- name: Checkout
uses: actions/checkout@v4
with:
ref: ${{ inputs.ref || github.ref }}

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
with:
version: latest
driver: docker-container
driver-opts: |
image=moby/buildkit:v0.22.0
network=host

- name: Login to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Build and push backend image
uses: Wandalen/wretry.action@v3.8.0
with:
action: docker/build-push-action@v6
with: |
context: ./langbuilder
file: ./langbuilder/docker/build_and_push_backend.Dockerfile
push: true
tags: ${{ env.IMAGE_PREFIX }}/langbuilder-backend:${{ needs.build-main.outputs.tag }},${{ env.IMAGE_PREFIX }}/langbuilder-backend:${{ needs.build-main.outputs.short_sha }}
build-args: |
LANGBUILDER_IMAGE=${{ env.IMAGE_PREFIX }}/langbuilder:${{ needs.build-main.outputs.tag }}
platforms: linux/amd64
cache-from: type=gha,scope=langbuilder-backend
cache-to: type=gha,mode=max,scope=langbuilder-backend
provenance: false

build-frontend:
name: Build frontend image
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- name: Checkout
uses: actions/checkout@v4
with:
ref: ${{ inputs.ref || github.ref }}

- name: Determine image tag
id: tag
env:
TAG_INPUT: ${{ inputs.tag }}
EVENT_NAME: ${{ github.event_name }}
FULL_SHA: ${{ github.sha }}
run: |
if [[ "$EVENT_NAME" == "workflow_dispatch" && -n "$TAG_INPUT" ]]; then
TAG="$TAG_INPUT"
else
TAG="latest"
fi
SHORT_SHA="${FULL_SHA:0:7}"
echo "tag=$TAG" >> "$GITHUB_OUTPUT"
echo "short_sha=$SHORT_SHA" >> "$GITHUB_OUTPUT"

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
with:
version: latest
driver: docker-container
driver-opts: |
image=moby/buildkit:v0.22.0
network=host

- name: Login to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Build and push frontend image
uses: Wandalen/wretry.action@v3.8.0
with:
action: docker/build-push-action@v6
with: |
context: ./langbuilder
file: ./langbuilder/docker/frontend/build_and_push_frontend.Dockerfile
push: true
tags: ${{ env.IMAGE_PREFIX }}/langbuilder-frontend:${{ steps.tag.outputs.tag }},${{ env.IMAGE_PREFIX }}/langbuilder-frontend:${{ steps.tag.outputs.short_sha }}
platforms: linux/amd64
cache-from: type=gha,scope=langbuilder-frontend
cache-to: type=gha,mode=max,scope=langbuilder-frontend
provenance: false
84 changes: 84 additions & 0 deletions .github/workflows/docker-build-openwebui.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
name: Build and Push OpenWebUI
run-name: Build OpenWebUI Docker image by @${{ github.actor }}

on:
workflow_dispatch:
inputs:
tag:
description: "Image tag (e.g., latest, v1.0.0)"
required: false
type: string
default: "latest"
ref:
description: "Git ref to build from (branch, tag, SHA)"
required: false
type: string

push:
branches: [main]
paths:
- "openwebui/**"
- ".github/workflows/docker-build-openwebui.yml"

jobs:
build:
name: Build & Push OpenWebUI
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- name: Checkout
uses: actions/checkout@v4
with:
ref: ${{ inputs.ref || github.ref }}

- name: Determine image tag
id: tag
env:
TAG_INPUT: ${{ inputs.tag }}
EVENT_NAME: ${{ github.event_name }}
FULL_SHA: ${{ github.sha }}
run: |
if [[ "$EVENT_NAME" == "workflow_dispatch" && -n "$TAG_INPUT" ]]; then
TAG="$TAG_INPUT"
else
TAG="latest"
fi
SHORT_SHA="${FULL_SHA:0:7}"
echo "tag=$TAG" >> "$GITHUB_OUTPUT"
echo "short_sha=$SHORT_SHA" >> "$GITHUB_OUTPUT"

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
with:
version: latest
driver: docker-container
driver-opts: |
image=moby/buildkit:v0.22.0
network=host

- name: Login to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Build and push
uses: Wandalen/wretry.action@v3.8.0
with:
action: docker/build-push-action@v6
with: |
context: ./openwebui
file: ./openwebui/Dockerfile
push: true
tags: ghcr.io/cloudgeometry/openwebui:${{ steps.tag.outputs.tag }},ghcr.io/cloudgeometry/openwebui:${{ steps.tag.outputs.short_sha }}
build-args: |
USE_OLLAMA=false
USE_CUDA=false
BUILD_HASH=${{ github.sha }}
platforms: linux/amd64
cache-from: type=gha
cache-to: type=gha,mode=max
provenance: false
Loading
Loading