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 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: Restart HuggingFace Spaces Build # There's a script in ./scripts/factory_reset_space.py that will reset the build # using the HUGGINGFACE_API_TOKEN secret run: | python ./scripts/factory_reset_space.py env: HUGGINGFACE_API_TOKEN: ${{ secrets.HUGGINGFACE_API_TOKEN }}