103 lines
3.3 KiB
YAML
103 lines
3.3 KiB
YAML
name: Docker Build and Push
|
|
on:
|
|
workflow_call:
|
|
inputs:
|
|
version:
|
|
required: true
|
|
type: string
|
|
release_type:
|
|
required: true
|
|
type: string
|
|
workflow_dispatch:
|
|
inputs:
|
|
version:
|
|
required: true
|
|
type: string
|
|
release_type:
|
|
required: true
|
|
type: choice
|
|
options:
|
|
- base
|
|
- main
|
|
env:
|
|
POETRY_VERSION: "1.8.2"
|
|
|
|
jobs:
|
|
docker_build:
|
|
name: Build Docker Image
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
- name: Set up QEMU
|
|
uses: docker/setup-qemu-action@v3
|
|
- name: Set up Docker Buildx
|
|
uses: docker/setup-buildx-action@v3
|
|
- name: Login to Docker Hub
|
|
uses: docker/login-action@v3
|
|
with:
|
|
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
|
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
|
- name: Set Dockerfile and Tags
|
|
id: set-vars
|
|
run: |
|
|
if [ "${{ inputs.release_type }}" == "base" ]; then
|
|
echo "DOCKERFILE=./docker/build_and_push_base.Dockerfile" >> $GITHUB_ENV
|
|
echo "TAGS=langflowai/langflow:base-${{ inputs.version }}" >> $GITHUB_ENV
|
|
else
|
|
echo "DOCKERFILE=./docker/build_and_push.Dockerfile" >> $GITHUB_ENV
|
|
echo "TAGS=langflowai/langflow:${{ inputs.version }},langflowai/langflow:1.0-alpha" >> $GITHUB_ENV
|
|
fi
|
|
- name: Build and push
|
|
uses: docker/build-push-action@v5
|
|
with:
|
|
context: .
|
|
push: true
|
|
file: ${{ env.DOCKERFILE }}
|
|
tags: ${{ env.TAGS }}
|
|
- name: Wait for Docker Hub to propagate
|
|
run: sleep 120
|
|
- name: Build and push (backend)
|
|
if: ${{ inputs.release_type == 'main' }}
|
|
uses: docker/build-push-action@v5
|
|
with:
|
|
context: .
|
|
push: true
|
|
file: ./docker/build_and_push_backend.Dockerfile
|
|
build-args: |
|
|
LANGFLOW_IMAGE=langflowai/langflow:${{ inputs.version }}
|
|
tags: |
|
|
langflowai/langflow-backend:${{ inputs.version }}
|
|
langflowai/langflow-backend:1.0-alpha
|
|
- name: Build and push (frontend)
|
|
if: ${{ inputs.release_type == 'main' }}
|
|
uses: docker/build-push-action@v5
|
|
with:
|
|
context: .
|
|
push: true
|
|
file: ./docker/frontend/build_and_push_frontend.Dockerfile
|
|
tags: |
|
|
langflowai/langflow-frontend:${{ inputs.version }}
|
|
langflowai/langflow-frontend:1.0-alpha
|
|
|
|
restart-space:
|
|
runs-on: ubuntu-latest
|
|
strategy:
|
|
matrix:
|
|
python-version:
|
|
- "3.12"
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
- name: Set up Python ${{ matrix.python-version }} + Poetry ${{ env.POETRY_VERSION }}
|
|
uses: "./.github/actions/poetry_caching"
|
|
with:
|
|
python-version: ${{ matrix.python-version }}
|
|
poetry-version: ${{ env.POETRY_VERSION }}
|
|
cache-key: ${{ runner.os }}-poetry-${{ env.POETRY_VERSION }}-${{ hashFiles('**/poetry.lock') }}
|
|
- name: Install Python dependencies
|
|
run: |
|
|
poetry env use ${{ matrix.python-version }}
|
|
poetry install
|
|
|
|
- name: Restart HuggingFace Spaces Build
|
|
run: |
|
|
poetry run python ./scripts/factory_restart_space.py --space "Langflow/Langflow-Preview" --token ${{ secrets.HUGGINGFACE_API_TOKEN }}
|