Browse Source

Enhance/introduce uv (#81)

* enhance: introduce uv

* fix: missing pip module

* add docker build to github actions

* fix: replace pip3 with pip

* fix

* fix: add pip

* fix

* fix

* add find uv test

* fix

* fix

* fix

* fix

* fix

* fix

* fix
Yeuoly 4 months ago
parent
commit
32cd95f9d4
2 changed files with 12 additions and 2 deletions
  1. 6 0
      .github/workflows/build-push.yml
  2. 6 2
      docker/local.dockerfile

+ 6 - 0
.github/workflows/build-push.yml

@@ -5,6 +5,9 @@ on:
     branches:
       - "main"
       - "deploy/dev"
+  pull_request:
+    branches:
+      - "main"
   release:
     types: [published]
 
@@ -71,12 +74,14 @@ jobs:
         run: docker build --build-arg PLATFORM=${{ matrix.scope }} --build-arg VERSION=${{ github.sha }} -t dify-plugin-daemon -f ./docker/${{ matrix.scope }}.dockerfile .
 
       - name: Tag Docker Images
+        if: github.event_name != 'pull_request'
         run:
           for tag in $(echo "${{ steps.meta.outputs.tags }}" | tr ',' '\n');
           do
             docker tag dify-plugin-daemon "$tag-${{ matrix.scope }}-${{ env.PLATFORM_PAIR }}";
           done
       - name: Push Docker Image
+        if: github.event_name != 'pull_request'
         run:
           for tag in $(echo "${{ steps.meta.outputs.tags }}" | tr ',' '\n');
           do
@@ -84,6 +89,7 @@ jobs:
           done
 
   create-manifest:
+    if: github.event_name != 'pull_request'
     needs: build
     runs-on: ubuntu-latest
     strategy:

+ 6 - 2
docker/local.dockerfile

@@ -33,12 +33,16 @@ WORKDIR /app
 ARG PLATFORM=local
 
 # Install python3.12 if PLATFORM is local
-RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y python3.12 python3.12-venv python3.12-dev ffmpeg \
+RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y curl python3.12 python3.12-venv python3.12-dev python3-pip ffmpeg \
     && apt-get clean \
     && rm -rf /var/lib/apt/lists/* \
     && update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.12 1;
 
-RUN pip3 install uv
+# Install uv
+RUN mv /usr/lib/python3.12/EXTERNALLY-MANAGED /usr/lib/python3.12/EXTERNALLY-MANAGED.bk && python3 -m pip install uv
+
+# Test uv
+RUN python3 -c "from uv._find_uv import find_uv_bin;print(find_uv_bin())"
 
 ENV PLATFORM=$PLATFORM
 ENV GIN_MODE=release