chore: Update Docker build workflow to include base and component images
This commit is contained in:
parent
d921865e45
commit
c818c47594
1 changed files with 45 additions and 40 deletions
85
.github/workflows/docker-build.yml
vendored
85
.github/workflows/docker-build.yml
vendored
|
|
@ -23,14 +23,24 @@ env:
|
||||||
POETRY_VERSION: "1.8.2"
|
POETRY_VERSION: "1.8.2"
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
docker_build:
|
setup:
|
||||||
name: Build Docker Image
|
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
outputs:
|
||||||
|
base_tags: ${{ steps.set-vars.outputs.base_tags }}
|
||||||
|
main_tags: ${{ steps.set-vars.outputs.main_tags }}
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v4
|
||||||
|
- name: Set Dockerfile and Tags
|
||||||
|
id: set-vars
|
||||||
|
run: |
|
||||||
|
echo "::set-output name=base_tags::langflowai/langflow:base-${{ inputs.version }}"
|
||||||
|
echo "::set-output name=main_tags::langflowai/langflow:${{ inputs.version }},langflowai/langflow:1.0-alpha"
|
||||||
|
|
||||||
|
build_base:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
needs: setup
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
- name: Set up QEMU
|
|
||||||
uses: docker/setup-qemu-action@v3
|
|
||||||
id: qemu
|
|
||||||
- name: Set up Docker Buildx
|
- name: Set up Docker Buildx
|
||||||
uses: docker/setup-buildx-action@v3
|
uses: docker/setup-buildx-action@v3
|
||||||
- name: Login to Docker Hub
|
- name: Login to Docker Hub
|
||||||
|
|
@ -38,56 +48,51 @@ jobs:
|
||||||
with:
|
with:
|
||||||
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
||||||
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
||||||
- name: Set Dockerfile and Tags
|
- name: Build and push Base Image
|
||||||
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
|
uses: docker/build-push-action@v5
|
||||||
with:
|
with:
|
||||||
context: .
|
context: .
|
||||||
push: true
|
push: true
|
||||||
platforms: "linux/amd64,linux/arm64/v8"
|
platforms: "linux/amd64,linux/arm64/v8"
|
||||||
file: ${{ env.DOCKERFILE }}
|
file: ./docker/build_and_push_base.Dockerfile
|
||||||
tags: ${{ env.TAGS }}
|
tags: ${{ needs.setup.outputs.base_tags }}
|
||||||
- name: Wait for Docker Hub to propagate
|
|
||||||
run: sleep 120
|
build_components:
|
||||||
- name: Build and push (backend)
|
runs-on: ubuntu-latest
|
||||||
if: ${{ inputs.release_type == 'main' }}
|
needs: build_base
|
||||||
|
strategy:
|
||||||
|
matrix:
|
||||||
|
component: [backend, frontend]
|
||||||
|
include:
|
||||||
|
- component: backend
|
||||||
|
dockerfile: ./docker/build_and_push_backend.Dockerfile
|
||||||
|
tags: langflowai/langflow-backend:${{ inputs.version }},langflowai/langflow-backend:1.0-alpha
|
||||||
|
- component: frontend
|
||||||
|
dockerfile: ./docker/frontend/build_and_push_frontend.Dockerfile
|
||||||
|
tags: langflowai/langflow-frontend:${{ inputs.version }},langflowai/langflow-frontend:1.0-alpha
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v4
|
||||||
|
- 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: Build and push ${{ matrix.component }}
|
||||||
uses: docker/build-push-action@v5
|
uses: docker/build-push-action@v5
|
||||||
with:
|
with:
|
||||||
context: .
|
context: .
|
||||||
push: true
|
push: true
|
||||||
platforms: "linux/amd64,linux/arm64/v8"
|
platforms: "linux/amd64,linux/arm64/v8"
|
||||||
file: ./docker/build_and_push_backend.Dockerfile
|
file: ${{ matrix.dockerfile }}
|
||||||
build-args: |
|
tags: ${{ matrix.tags }}
|
||||||
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
|
|
||||||
platforms: "linux/amd64,linux/arm64/v8"
|
|
||||||
tags: |
|
|
||||||
langflowai/langflow-frontend:${{ inputs.version }}
|
|
||||||
langflowai/langflow-frontend:1.0-alpha
|
|
||||||
|
|
||||||
restart-space:
|
restart-space:
|
||||||
name: Restart HuggingFace Spaces
|
name: Restart HuggingFace Spaces
|
||||||
if: ${{ inputs.release_type == 'main' }}
|
if: ${{ inputs.release_type == 'main' }}
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
needs: docker_build
|
needs: build_base
|
||||||
strategy:
|
strategy:
|
||||||
matrix:
|
matrix:
|
||||||
python-version:
|
python-version:
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue